<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Godot</title>
    <description>The latest articles on DEV Community by Godot (@godot).</description>
    <link>https://dev.to/godot</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1127632%2F7c6b61be-b962-4c15-b97b-1cbb4bf1be1c.png</url>
      <title>DEV Community: Godot</title>
      <link>https://dev.to/godot</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/godot"/>
    <language>en</language>
    <item>
      <title>Online Visual Novel in Godot: Case Study on Sentou Gakuen</title>
      <dc:creator>Godot</dc:creator>
      <pubDate>Thu, 10 Oct 2024 19:52:26 +0000</pubDate>
      <link>https://dev.to/godot/online-visual-novel-in-godot-case-study-on-sentou-gakuen-33ce</link>
      <guid>https://dev.to/godot/online-visual-novel-in-godot-case-study-on-sentou-gakuen-33ce</guid>
      <description>&lt;p&gt;When you talk about visual novel games, you'd normally think of a static story-driven experience, often with branching paths and multiple endings. You may have hundreds of routes but ultimately designed for solo play. It is why some people consider that visual novel as a genre isn't a game, but more of an interactive storybook. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;However, what if you could take the concept of a visual novel and turn it into an online interactive experience?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/Bfsm5jRWZGk"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;In this short case study, we will focus on how Sentou Gakuen, an online visual novel developed in Godot Engine, attempts to redefine the genre. We'll explore some of the challenges involved and why this approach was chosen for the project. Let's dive in!&lt;/p&gt;

&lt;h3&gt;
  
  
  Traditional Visual Novels
&lt;/h3&gt;

&lt;p&gt;Visual novels are well-established in game development—often comprising rich narratives, multiple routes, and player choices that influence outcomes. There are various engine options for creating visual novels, such as Ren'Py, TyranoBuilder, Unity, and Godot Engine is no different. With Godot Engine, numerous developers have created compelling and visually stunning visual novels that allow players to dive deep into story-driven experiences. However, when we introduce the concept of &lt;em&gt;online interactivity&lt;/em&gt; into a visual novel, a whole new set of challenges emerges.&lt;/p&gt;

&lt;h3&gt;
  
  
  Gameplay: Dynamic vs. Static
&lt;/h3&gt;

&lt;p&gt;Traditional visual novels are primarily static, designed around branching paths and predefined outcomes. They typically consist of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Linear Narratives&lt;/strong&gt;: While choices may lead to different routes, all possibilities are predetermined. Time, place, and location depends on how are you progressing through the story.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Single-Player Focus&lt;/strong&gt;: The game is designed for one person to play at their own pace, with no impact from other players. Players are limited to the choices provided by the game, with no real-time interactions or shared experiences.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In contrast, Sentou Gakuen introduces dynamic mechanics:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Shared World&lt;/strong&gt;: Player actions influence not just their experience, but the experience of others, similar to a multiplayer RPG. The world has day and night cycles, when it's morning for one player, it's morning for everyone. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Community Interaction&lt;/strong&gt;: Players can communicate through an in-game chat system, post on community boards, and engage in shared events.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This kind of shared experience requires a different design approach. The narrative isn't purely about routes but rather a fluid storyline influenced by the cumulative actions of many players.&lt;/p&gt;

&lt;h3&gt;
  
  
  Interactive Visual Novels
&lt;/h3&gt;

&lt;p&gt;This paradigm shift from a static, single-player experience to a dynamic, shared world introduces a host of technical and design challenges such as, but not limited to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A Persistent World&lt;/strong&gt;: In a multiplayer setting, ensuring that all players experience the same world state at the same time is crucial, preventing discrepancies that could disrupt immersion.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Keeping the World Alive&lt;/strong&gt;: Creating a lively and dynamic environment, ensuring the game world feels active and interconnected, even when players are exploring alone.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Communication&lt;/strong&gt;: Effectively managing player communication in a way that aligns with the visual novel's narrative style while accommodating simultaneous interactions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Player versus Player (PvP)&lt;/strong&gt;: Integrating competitive elements into a visual novel in a way that complements the narrative-driven experience rather than overshadowing it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let’s delve into how the game tackles these obstacles to redefine the genre.&lt;/p&gt;

&lt;h3&gt;
  
  
  Key Challenge: A Persistent World
&lt;/h3&gt;

&lt;p&gt;In traditional offline visual novels, time and location are tightly controlled by the player’s individual progression through the story. The &lt;em&gt;world revolves around the player&lt;/em&gt;, and events occur based solely on where they are in the narrative. However, Sentou Gakuen presents a dynamic world where multiple players interact in real time. This shift from static storytelling to a shared world creates a unique challenge: making sure that all players experience the same world state at the same time.&lt;/p&gt;

&lt;h4&gt;
  
  
  The Problem: Synchronization in a Dynamic World
&lt;/h4&gt;

&lt;p&gt;In Sentou Gakuen, the world needs to be consistent for everyone. For example, if it’s morning for one player, it should be morning for everyone else in the game. Similarly, if a bank is open for business, it has to be open for every player, not just those at a particular point in the story. Having players exist in different “times” would break immersion and create confusion. This required a solution to keep everyone on the same page regarding the state of the game world.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzt96b5q0igz45tz0q54t.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzt96b5q0igz45tz0q54t.gif" alt="Day-Night Cycle in Sentou Gakuen" width="544" height="306"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  The Solution: Real-Time Synchronization Using Unix Timestamps
&lt;/h4&gt;

&lt;p&gt;To address this challenge, a simple yet effective solution was implemented: Shared Timestamps. By using a common time reference, the game ensures that all players experience the same time of day, the same events, and the same world state. This simple mechanism keeps the world persistent and coherent, even as multiple players interact with it simultaneously.&lt;/p&gt;

&lt;h3&gt;
  
  
  Key Challenge: Keeping the World Alive
&lt;/h3&gt;

&lt;p&gt;What makes a game world feel alive? It’s the sense that things are happening, even when you’re not around. This is not a concern in single-player games, where the world revolves around the player. But in a shared online environment, that's not the case.&lt;/p&gt;

&lt;h4&gt;
  
  
  The Problem: Making it Feel Lively
&lt;/h4&gt;

&lt;p&gt;In a multiplayer game, one of the challenges is ensuring the world feels alive and dynamic. Players need to feel like they are part of an active, bustling world, &lt;em&gt;even if there are no other players around&lt;/em&gt; at the same time. A static world can quickly become boring, leaving players feeling disconnected from the community.&lt;/p&gt;

&lt;h4&gt;
  
  
  The Solution: The World Full of Happenings
&lt;/h4&gt;

&lt;p&gt;To make Sentou Gakuen feel lively, each zone in the game features an interface that logs recent events and activities that other players have completed. While not updated in real time, these logs show what players have done in that zone, such as someone being defeated in a brawl or completing a particular event. By displaying these “happenings,” the game creates a sense of a constantly evolving world, making players feel part of a larger, active community. This feature not only adds immersion but also encourages players to engage with the world, knowing their actions contribute to its evolving story.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3qo3d8thw24p00cqaanm.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3qo3d8thw24p00cqaanm.jpg" alt="Zone Happenings in Sentou Gakuen" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Furthermore, the faction system enhances the dynamism of the game world. Players can join one of two factions: &lt;em&gt;Hikari&lt;/em&gt; or &lt;em&gt;Yami&lt;/em&gt;. Zones in the game have a "controlling faction," determined by which faction has the most presence in that zone. By simply being online in a particular zone, players contribute to their faction’s influence. For example, if a player from Yami is in the School Gate zone, they increase Yami's influence there.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3ysncjkzf1cgxfkb03vb.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3ysncjkzf1cgxfkb03vb.jpg" alt="Factions in Sentou Gakuen" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The dominant faction in a zone rewards its members with buff, encouraging faction members to compete for control of different zones. This ongoing power struggle ensures the game world remains dynamic, with faction control shifting based on player participation, creating an evolving landscape for players to interact with.&lt;/p&gt;

&lt;h3&gt;
  
  
  Key Challenge: Chat System Integration
&lt;/h3&gt;

&lt;p&gt;One of the biggest challenges in creating an online visual novel is handling player communication in a way that fits the traditional visual novel style. In a normal visual novel, character dialogues are presented with neatly formatted text boxes that pop up one at a time, allowing players to fully absorb the conversation at their own pace. Initially, The project aimed for a similar experience, where player chat messages would appear as dialogues, just like when a character speaks in the game. However, this approach quickly ran into significant issues.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2iyw4uoldthlb9bb8ort.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2iyw4uoldthlb9bb8ort.gif" alt="Player Chatting" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  The Problem: Managing Concurrent Chats
&lt;/h4&gt;

&lt;p&gt;In Sentou Gakuen, multiple players are interacting with each other simultaneously, and when there's a lot of chatter happening at once, it can be challenging to keep up with the conversation. The traditional visual novel dialogue box system, while great for presenting character dialogues, wasn't well-suited for handling real-time player interactions. Players could easily miss messages or get lost in the conversation, leading to a disjointed experience.&lt;/p&gt;

&lt;h4&gt;
  
  
  The Solution: Transition to a "Chat Box"
&lt;/h4&gt;

&lt;p&gt;To solve this problem, a decision to add seamless transition from visual novel-style dialogue boxes to a more conventional MMO chat box system was made. This allowed players to keep up with ongoing conversations more naturally, while still being able to engage with the story and interact with other players. The chat box will replace the dialogue box automatically when there's too much chatter happening in the game, and players can switch between the two as needed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyzym2r0c7aplia4p3u5f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyzym2r0c7aplia4p3u5f.png" alt="Chat Box in Sentou Gakuen" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This compromise maintained the essence of a visual novel while accommodating the realities of multiplayer communication. Players could enjoy the rich story elements without losing track of real-time conversations happening within the game.&lt;/p&gt;

&lt;h3&gt;
  
  
  Key Challenge: Player versus Player
&lt;/h3&gt;

&lt;p&gt;How do you introduce competitive elements into a visual novel without compromising the experience? PvP mechanics can add depth and excitement to a game, but in a genre focused on storytelling, it’s essential to find a balance that keeps the narrative at the forefront while still providing engaging gameplay.&lt;/p&gt;

&lt;h4&gt;
  
  
  The Problem: Can this be done?
&lt;/h4&gt;

&lt;p&gt;Integrating Player versus Player (PvP) mechanics into a visual novel is a concept that has rarely, if ever, been explored. Most visual novels focus on narrative-driven experiences, often limiting player interactions to choices and branching paths. Adding competitive elements introduces a challenge: how can we incorporate PvP in a way that feels natural and maintains the essence of a visual novel, rather than turning it into a traditional combat game?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw1xy570baqjemrhoa0x8.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw1xy570baqjemrhoa0x8.jpg" alt="PvP in Sentou Gakuen" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  The Solution: Asynchronous PvP
&lt;/h4&gt;

&lt;p&gt;While Sentou Gakuen doesn't feature direct real-time PvP, it introduces indirect, asynchronous PvP that still fosters competition in two key ways:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2okjhjq21w3uvtu44s64.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2okjhjq21w3uvtu44s64.jpg" alt="Fight Club in Sentou Gakuen" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Players can create their own loadout and participate as challengers. Once enrolled, other students can challenge these pre-set loadouts in turn-based combat. This system allows for strategic battles without the need for both players to be online simultaneously.&lt;/li&gt;
&lt;li&gt;In school zones, players have a chance to "appear" as a mob in another player’s instance during a fight. This simulates PvP encounters in a controlled environment and adds a personal touch to otherwise AI-controlled battles. If preferred, this feature can be turned off for those who want to avoid appearing in others' instances.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Key Challenge: What Engine to Choose?
&lt;/h3&gt;

&lt;p&gt;Godot Engine was chosen for Sentou Gakuen for several reasons:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5g3n4uogkyiqy3ziglc6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5g3n4uogkyiqy3ziglc6.png" alt="Godot Engine and GodotSteam" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Flexibility&lt;/strong&gt;: The engine’s open-source nature and robust feature set made it possible to implement complex systems and mechanics that would have been challenging in other engines.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Networking with GodotSteam&lt;/strong&gt;: The game utilizes GodotSteam, leveraging the Steamworks API to handle networking functionalities. This integration simplifies the implementation of multiplayer mechanics and ensures a seamless online experience.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ease of Use&lt;/strong&gt;: Godot’s GDScript made it easy to prototype and iterate on game systems, allowing for rapid development and testing of new features.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cross-Platform Compatibility&lt;/strong&gt;: Godot’s support for multiple platforms ensures that the project can reach a wide audience, regardless of the system they’re running.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And while Godot Engine was the choice for the project, it’s essential to evaluate the engine based on the specific needs of your project. Each engine has its strengths and weaknesses, and choosing the right one can significantly impact the development process and the final product.&lt;/p&gt;

&lt;h3&gt;
  
  
  Wrappping Up
&lt;/h3&gt;

&lt;p&gt;Creating Sentou Gakuen in Godot was a journey of pushing the boundaries of what a visual novel can be. While traditional visual novels focus on static routes and single-player experiences, Sentou Gakuen aimed to create a shared, interactive story space where every player’s actions could influence the wider game world. Godot’s flexibility allowed the project to achieve that vision, even though it came with challenges.&lt;/p&gt;

&lt;p&gt;This case study highlights possibilities for future visual novel projects, showing that the genre can evolve beyond its traditional roots to create engaging, dynamic experiences that bring players together in new and exciting ways. Visual novels can become more than just interactive storybooks!&lt;/p&gt;


&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
      &lt;div class="c-embed__cover"&gt;
        &lt;a href="https://store.steampowered.com/app/405680/Sentou_Gakuen_Revival/?utm_source=css" class="c-link s:max-w-50 align-middle" rel="noopener noreferrer"&gt;
          &lt;img alt="" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fshared.fastly.steamstatic.com%2Fstore_item_assets%2Fsteam%2Fapps%2F405680%2Fcapsule_616x353.jpg%3Ft%3D1742686323" height="353" class="m-0" width="616"&gt;
        &lt;/a&gt;
      &lt;/div&gt;
    &lt;div class="c-embed__body"&gt;
      &lt;h2 class="fs-xl lh-tight"&gt;
        &lt;a href="https://store.steampowered.com/app/405680/Sentou_Gakuen_Revival/?utm_source=css" rel="noopener noreferrer" class="c-link"&gt;
          Sentou Gakuen: Revival on Steam
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;p class="truncate-at-3"&gt;
          You are one of the students of Sentou Gakuen, a random school in Japan, filled with delinquents, rascals, and of course some good students. How will you spend your days in Sentou Gakuen? Forge your own path in this online interactive Visual Novel, make friends or foes, the choice is yours.
        &lt;/p&gt;
      &lt;div class="color-secondary fs-s flex items-center"&gt;
          &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstore.steampowered.com%2Ffavicon.ico" width="256" height="256"&gt;
        store.steampowered.com
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;If you’re interested in exploring the world of Sentou Gakuen, you can check out the game on &lt;a href="https://store.steampowered.com/app/405680/Sentou_Gakuen_Revival/?snr=1_5_1100__1100&amp;amp;utm_source=css" rel="noopener noreferrer"&gt;Steam here&lt;/a&gt; or join the &lt;a href="https://discord.gg/GUJkUWymmT" rel="noopener noreferrer"&gt;Discord&lt;/a&gt;, while the final release date is yet to be announced, in the meantime you can try the demo to get a taste of what’s to come.&lt;/p&gt;

</description>
      <category>gamedev</category>
      <category>showdev</category>
      <category>godot</category>
      <category>godotengine</category>
    </item>
    <item>
      <title>Godot 4.2.1 Maintenance Release Overview</title>
      <dc:creator>Godot</dc:creator>
      <pubDate>Tue, 12 Dec 2023 12:57:10 +0000</pubDate>
      <link>https://dev.to/godot/godot-421-maintenance-release-overview-j05</link>
      <guid>https://dev.to/godot/godot-421-maintenance-release-overview-j05</guid>
      <description>&lt;p&gt;Godot 4.2.1, the latest maintenance release, is now available, focusing on resolving platform compatibility issues introduced in Godot 4.2. The update aims to facilitate smoother upgrades from version 4.1 and supports new projects across all platforms.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Fixes:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;GL Compatibility Renderer on macOS:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Reverted the default backend from ANGLE's Metal back to native OpenGL drivers due to issues introduced by ANGLE's Metal backend.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;macOS One-Click Deploy:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Addressed freezing issues caused by the Xcode install dialog during iOS one-click deploy by switching to &lt;code&gt;mdfind&lt;/code&gt; for Xcode presence checks.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Vulkan Renderer on Android:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Resolved crashes and mesh corruption issues in Vulkan renderers on Android, potentially fixing problems with tilemap rendering on specific Android devices.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Godot Jolt Addon Compatibility:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Introduced a workaround for compatibility issues with Godot Jolt addon, preventing crashes during project upgrades. Users are advised to update Godot Jolt to the latest version (0.11.0).&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;TileMap Occluders:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fixed a regression related to TileMap occluders, addressing issues present in the handling of these elements.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Emscripten Web Export:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Adjusted linker flags to address issues introduced by recent Emscripten releases, ensuring successful compilation and execution.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Additional Changes:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A total of 42 contributors made approximately 74 improvements for this release.&lt;/li&gt;
&lt;li&gt;The comprehensive list of changes is available in the &lt;a href="https://godotengine.github.io/godot-interactive-changelog/#4.2.1" rel="noopener noreferrer"&gt;interactive changelog&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;strong&gt;Download:&lt;/strong&gt;&lt;br&gt;
Be sure to check out the &lt;a href="https://godotengine.org/article/maintenance-release-godot-4-2-1/" rel="noopener noreferrer"&gt;original page&lt;/a&gt; for more details and to download the latest version of the engine. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Known Incompatibilities:&lt;/strong&gt;&lt;br&gt;
No known incompatibilities exist with previous Godot 4.2.x releases. Users are encouraged to upgrade to 4.2.1. Report any unexpected behavior on &lt;a href="https://github.com/godotengine/godot/issues" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Support:&lt;/strong&gt;&lt;br&gt;
Godot is a non-profit, open-source project sustained by contributions from developers and donations from the community. Financial support can be provided through the &lt;a href="https://fund.godotengine.org/" rel="noopener noreferrer"&gt;Godot Development Fund&lt;/a&gt;, managed by the Godot Foundation. Appreciation is extended to all contributors and supporters.&lt;/p&gt;

</description>
      <category>godot</category>
      <category>godotengine</category>
      <category>gamedev</category>
    </item>
    <item>
      <title>Godot 4.2 Stable is Here!</title>
      <dc:creator>Godot</dc:creator>
      <pubDate>Thu, 30 Nov 2023 13:12:24 +0000</pubDate>
      <link>https://dev.to/godot/godot-42-stable-is-here-4joi</link>
      <guid>https://dev.to/godot/godot-42-stable-is-here-4joi</guid>
      <description>&lt;p&gt;&lt;strong&gt;Godot 4.2&lt;/strong&gt; is finally here, packed with exciting features and improvements for game developers. With over 1800 improvements submitted by 359 contributors, this release is a testament to the dedication and passion of the Godot community. &lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/wHXJPaj6988"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  New Features and Improvements
&lt;/h2&gt;

&lt;p&gt;Let's dive into some of the most significant highlights of this release:&lt;/p&gt;

&lt;h3&gt;
  
  
  Code Regions in the Code Editor
&lt;/h3&gt;

&lt;p&gt;One of my personal favorites in this release is the addition of &lt;strong&gt;Code Regions&lt;/strong&gt; for GDScript in the code editor. This feature allows you to break up your scripts into named, foldable blocks for better organization and navigation.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fock4gop468mhvh070c5b.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fock4gop468mhvh070c5b.gif" alt="Godot Code Region" width="576" height="647"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Critical and Breaking Changes
&lt;/h3&gt;

&lt;p&gt;While the Godot team strives for seamless compatibility between releases, some breaking changes are inevitable. To help with the migration process, they've provided a &lt;a href="https://docs.godotengine.org/en/4.2/tutorials/migrating/upgrading_to_godot_4.2.html" rel="noopener noreferrer"&gt;migration guide for 4.2&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Core and Systems
&lt;/h3&gt;

&lt;p&gt;This release focuses on stability, addressing design limitations, and fixing bugs related to renaming and moving files. Memory usage has also been optimized for projects using many plain Godot objects.&lt;/p&gt;

&lt;h3&gt;
  
  
  2D and 3D Features
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;New features for 2D games include integer scaling for pixel-perfect graphics and closed lines support for &lt;code&gt;Line2D&lt;/code&gt; nodes.&lt;/li&gt;
&lt;li&gt;In 3D, precise normals can now be calculated from raycast contact points using barycentric coordinates.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Animation Improvements
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;AnimationPlayer&lt;/code&gt; and &lt;code&gt;AnimationTree&lt;/code&gt; have been unified under the new &lt;code&gt;AnimationMixer&lt;/code&gt; node, addressing various issues and inconsistencies. Onion skinning has also made a return, allowing for better animation previews.&lt;/p&gt;

&lt;h3&gt;
  
  
  Navigation
&lt;/h3&gt;

&lt;p&gt;The navigation system now supports 2D navigation mesh baking and multi-threaded baking for both 2D and 3D navigation meshes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Tilemaps
&lt;/h3&gt;

&lt;p&gt;Tilemaps receive a plethora of improvements, including new tools for flipping and rotating tiles, performance optimizations, and usability enhancements.&lt;/p&gt;

&lt;h3&gt;
  
  
  Editor and Usability
&lt;/h3&gt;

&lt;p&gt;The editor has seen many improvements, such as better focus management, native file dialogs for desktop platforms, and an updated project manager.&lt;/p&gt;

&lt;h3&gt;
  
  
  GDExtension
&lt;/h3&gt;

&lt;p&gt;GDExtension sees a host of new features, including in-editor hot reloading, Web platform support, and new API functionalities.&lt;/p&gt;

&lt;h3&gt;
  
  
  GUI and Theming
&lt;/h3&gt;

&lt;p&gt;Focus management has been improved, and new features have been added to the &lt;code&gt;GraphEdit&lt;/code&gt; node. Other improvements include seamless video looping and better image handling in &lt;code&gt;RichTextLabel&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Import and Asset Pipeline
&lt;/h3&gt;

&lt;p&gt;Changes to the asset importing process include better handling of import type changes, new import options, and improved GLTF support.&lt;/p&gt;

&lt;h3&gt;
  
  
  Input
&lt;/h3&gt;

&lt;p&gt;Improvements to input handling include better mouse and focus event handling across multiple viewports and windows, as well as gamepad-related bug fixes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Multiplayer and Networking
&lt;/h3&gt;

&lt;p&gt;The high-level multiplayer system has been enhanced with better synchronization options and streamlined scene replication.&lt;/p&gt;

&lt;h3&gt;
  
  
  Porting and Platforms
&lt;/h3&gt;

&lt;p&gt;New features for porting include one-click deployment for iOS, native file dialogs for desktop platforms, and a new architecture for Android that unlocks new features like multiple window support and quicker startup times.&lt;/p&gt;




&lt;p&gt;Godot 4.2 is a significant release that brings a wealth of new features and improvements for game developers. There's too much to list here so be sure to &lt;a href="https://godotengine.org/article/godot-4-2-arrives-in-style/" rel="noopener noreferrer"&gt;check out the original page&lt;/a&gt; for more details and to download the latest version of the engine. &lt;/p&gt;

&lt;p&gt;As always, if you'd like to support the Godot project financially, consider making a &lt;a href="https://fund.godotengine.org/" rel="noopener noreferrer"&gt;recurring monthly donation&lt;/a&gt; to help ensure its sustainability and continued development. Your contributions go a long way in making Godot better for everyone.&lt;/p&gt;

</description>
      <category>gamedev</category>
      <category>news</category>
      <category>godot</category>
      <category>godotengine</category>
    </item>
    <item>
      <title>Godot 3 or Godot 4: Which Version Should You Choose?</title>
      <dc:creator>Godot</dc:creator>
      <pubDate>Fri, 15 Sep 2023 19:19:57 +0000</pubDate>
      <link>https://dev.to/godot/godot-3-or-godot-4-which-version-should-you-choose-2eb4</link>
      <guid>https://dev.to/godot/godot-3-or-godot-4-which-version-should-you-choose-2eb4</guid>
      <description>&lt;p&gt;&lt;strong&gt;Godot 3&lt;/strong&gt; and &lt;strong&gt;Godot 4&lt;/strong&gt;, two major versions of the engine that offer different features and capabilities. The goal is to help you make an informed decision on which version to choose for your game development projects. So let's dive in and explore the world of Godot!&lt;/p&gt;

&lt;h3&gt;
  
  
  Comparison of Godot 3 and Godot 4
&lt;/h3&gt;

&lt;p&gt;In this post, we'll be comparing the features, performance, and other aspects of Godot 3 and Godot 4. We'll also discuss the factors you should consider when choosing between these two versions for your game development projects.&lt;/p&gt;

&lt;p&gt;By the end of this post (hopefully), you'll have a clear understanding of the key differences between Godot 3 and Godot 4, along with recommendations on which version to choose based on your project needs and preferences.&lt;/p&gt;

&lt;h2&gt;
  
  
  Godot 3
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Overview and release date
&lt;/h3&gt;

&lt;p&gt;Godot 3 was released in January 2018, and it brought a plethora of new features and improvements over the previous version. Some of the most notable additions include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;A new rendering engine with support for physically based rendering (PBR)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Visual scripting, which allows users to create game logic without writing code&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Support for the C# programming language&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Key features
&lt;/h3&gt;

&lt;p&gt;Here are some of the key features of Godot 3:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;GLES2 and GLES3 rendering backends&lt;/strong&gt;: Godot 3 supports both OpenGL ES 2.0 and OpenGL ES 3.0 rendering backends, providing flexibility and compatibility with a wide range of hardware.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Visual scripting&lt;/strong&gt;: This feature allows users to create game logic using a node-based visual interface, without writing any code.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;C# support&lt;/strong&gt;: Godot 3 introduced support for the C# programming language, allowing developers to write game logic and scripts using a familiar and powerful language.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;3D improvements&lt;/strong&gt;: The engine received a significant update to its 3D capabilities, including support for PBR materials, global illumination, and improved shadows.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Extensive documentation and community support&lt;/strong&gt;: Godot 3 has a rich documentation and an active community that can help you with any issues or questions you might have.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Pros and cons of Godot 3
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Stable and mature&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Extensive documentation and community support&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Compatibility with older hardware&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Visual scripting and C# support&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Limitations in performance and visual quality compared to Godot 4&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Lacks some of the cutting-edge features found in Godot 4&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Stability and maturity
&lt;/h3&gt;

&lt;p&gt;Godot 3 is the current long-time support (LTS) version of the engine; it is stable and mature with years of development and testing behind it. This makes it a reliable choice for game development projects, especially if you're looking for a tried-and-tested solution that has been proven to work well.&lt;/p&gt;

&lt;h3&gt;
  
  
  Compatibility with older hardware
&lt;/h3&gt;

&lt;p&gt;One of the key advantages of Godot 3 is its compatibility with older hardware. The engine supports both GLES2 and GLES3 rendering backends, making it suitable for a wide range of devices, including older smartphones and tablets.&lt;/p&gt;

&lt;h3&gt;
  
  
  Limitations in performance and visual quality
&lt;/h3&gt;

&lt;p&gt;While Godot 3 offers a solid set of features and capabilities, it does have some limitations in terms of performance and visual quality compared to Godot 4. The newer version of the engine includes a more advanced rendering backend and various other improvements that can result in better performance and higher-quality visuals.&lt;/p&gt;

&lt;h2&gt;
  
  
  Godot 4
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Overview and expected release date
&lt;/h3&gt;

&lt;p&gt;Godot 4 is the current major release of the engine, and it introduced a host of new features and improvements over Godot 3. Some of the most notable changes include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Visual Scripting is dead&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A new Vulkan rendering backend&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;GDExtension, the successor of GDNative&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Improved 3D capabilities&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Enhanced UI and UX&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Godot 4 initially released in March 2023. As for now, Godot &lt;a href="https://godot.community/tags/godot4.2" rel="noopener noreferrer"&gt;4.2&lt;/a&gt; is currently in development.&lt;/p&gt;

&lt;h3&gt;
  
  
  Key features
&lt;/h3&gt;

&lt;p&gt;Here are some of the key features of Godot 4:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Visual Scripting is Dead&lt;/strong&gt;: In the latest iteration of Godot 4, the once-popular Visual Scripting feature has been entirely discontinued. This decision was made after extensive evaluation and feedback from the devs, which highlighted the need for a more streamlined and efficient approach to game development.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Vulkan rendering backend&lt;/strong&gt;: Godot 4 introduces a new Vulkan rendering backend, which promises better performance and visual quality compared to the GLES2 and GLES3 backends used in Godot 3.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;GDExtension and C++ support&lt;/strong&gt;: The engine offers improved support for GDExtension, the successor of GDNative, making it easier for developers to write high-performance game code natively.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Improved 3D capabilities&lt;/strong&gt;: Godot 4 features a host of improvements to its 3D capabilities, including support for real-time global illumination, volumetric fog, and improved shadows.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Enhanced UI and UX&lt;/strong&gt;: The user interface and user experience in Godot 4 received a major overhaul, making it more intuitive and user-friendly. Godot 4 also adds multiple windows support which wasn't possible in the previous version (Godot 3 only supports single window mode).&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Pros and cons of Godot 4
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Cutting-edge technology and performance&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Improved visual quality&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;New Vulkan rendering backend&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Enhanced UI and UX&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The Death of Visual Scripting&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Potential compatibility issues with older hardware&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Limited resources&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Cutting-edge technology and performance
&lt;/h3&gt;

&lt;p&gt;Godot 4 brings cutting-edge technology and performance improvements to the engine, making it an exciting choice for game developers who want to push the boundaries of what's possible with their projects.&lt;/p&gt;

&lt;h3&gt;
  
  
  Improved visual quality
&lt;/h3&gt;

&lt;p&gt;Thanks to the new Vulkan rendering backend and various other enhancements, Godot 4 promises to deliver improved visual quality compared to Godot 3. This can be a significant advantage for developers who prioritize high-quality graphics in their games.&lt;/p&gt;

&lt;h3&gt;
  
  
  Potential compatibility issues
&lt;/h3&gt;

&lt;p&gt;One potential drawback of Godot 4 is that the new Vulkan rendering backend may not be compatible with older hardware. This could be an issue for developers targeting a wide range of devices, especially older smartphones and tablets.&lt;/p&gt;

&lt;h3&gt;
  
  
  Limited resources
&lt;/h3&gt;

&lt;p&gt;As Godot 4 is still new, the documentation, tutorials, and resources for the engine are currently limited, ie. undocumented changes, etc. This could pose challenges for developers who rely on these resources to learn and troubleshoot issues during development.&lt;/p&gt;

&lt;h2&gt;
  
  
  Factors to consider when choosing a version
&lt;/h2&gt;

&lt;p&gt;When deciding between Godot 3 and Godot 4, there are several factors to consider:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Project requirements&lt;/strong&gt;: Consider the specific needs of your project, such as performance, visual quality, and compatibility with target platforms.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Compatibility with target platforms&lt;/strong&gt;: If you need to support older hardware, Godot 3's GLES2 and GLES3 rendering backends may be more suitable.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Development timeline&lt;/strong&gt;: If you're working on a project with a tight schedule, you might prefer the stability and maturity of Godot 3.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Stability and maturity of the engine&lt;/strong&gt;: Godot 3 is a stable and mature version of the engine, while Godot 4 is still in development and may have some bugs and issues.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Availability of documentation and resources&lt;/strong&gt;: Godot 3 has extensive documentation and resources, while Godot 4's resources are currently limited.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;As Godot 4 is steadily progressing towards its next significant milestone with the upcoming release of Version 4.2, it is becoming increasingly viable for developers to consider making the transition. When determining the best choice for your project, it is essential to weigh your specific requirements and preferences carefully. If you place a high value on stability, maturity, and compatibility with older hardware, then Godot 3 might be a more suitable option for your needs. However, if you are willing to embrace the cutting-edge, then making the jump to the latest version could be a strategic decision for your project's future success.&lt;/p&gt;

&lt;p&gt;Ultimately, we encourage you to explore both versions and make an informed decision based on your project requirements and personal preferences. Happy game development!&lt;/p&gt;

</description>
      <category>godotengine</category>
      <category>godot</category>
      <category>gamedev</category>
    </item>
    <item>
      <title>Unity New Pricing in 2024 is Absurd</title>
      <dc:creator>Godot</dc:creator>
      <pubDate>Tue, 12 Sep 2023 15:27:58 +0000</pubDate>
      <link>https://dev.to/godot/unity-new-pricing-in-2024-is-crazy-3hnn</link>
      <guid>https://dev.to/godot/unity-new-pricing-in-2024-is-crazy-3hnn</guid>
      <description>&lt;p&gt;&lt;em&gt;Unity’s new pricing update sparks controversy among developers&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Unity, one of the most popular game engines in the world, has announced a new pricing and packaging update that will affect games that exceed certain revenue and install thresholds, according to the official &lt;a href="https://blog.unity.com/news/plan-pricing-and-packaging-updates" rel="noopener noreferrer"&gt;blog post&lt;/a&gt;. It seems that this update aims to "align Unity's success with the success of our customers" and to "ensure Unity remains a sustainable platform for all developers".&lt;/p&gt;

&lt;p&gt;The update introduces a runtime fee for games that generate more than $200,000 in revenue and have more than 200,000 installs in a month. The fee varies depending on the game's install count, ranging from $0.01 to $0.20 per install. Only games that meet the following thresholds qualify for the Unity Runtime Fee:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Unity Personal and Unity Plus&lt;/strong&gt;: Those that have made $200,000 USD or more in the last 12 months AND have at least 200,000 lifetime game installs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Unity Pro and Unity Enterprise&lt;/strong&gt;: Those that have made $1,000,000 USD or more in the last 12 months AND have at least 1,000,000 lifetime game installs.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsdc5vlfuoxik1qu9eyb2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsdc5vlfuoxik1qu9eyb2.png" alt="unity new pricing 2024" width="715" height="627"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The update has generated a lot of discussion and criticism from the developer community, especially from indie developers who fear that the fee will hurt their profitability and creativity. Many users have expressed their opinions and concerns on Reddit, where &lt;a href="https://www.reddit.com/r/Unity3D/comments/16gqv1s/unity_plan_pricing_and_packaging_updates/" rel="noopener noreferrer"&gt;the post&lt;/a&gt; has received hundreds of upvotes and hundred of comments.&lt;/p&gt;

&lt;p&gt;This announcement has also unexpectedly sparked concerns among /r/gachagaming subreddit dwellers, as rerolling (effectively, reinstalling the game, over and over for a better account) is a very common practice in the community. The &lt;a href="https://www.reddit.com/r/gachagaming/comments/16guprn/unity_now_charges_developers_for_each_installs/" rel="noopener noreferrer"&gt;post&lt;/a&gt; has garnered hundreds of upvotes and comments combined.&lt;/p&gt;

&lt;p&gt;Some of the common questions and issues raised by the users are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;How will Unity track and enforce the fee? What if users install games offline or on multiple devices?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;How will the fee affect games that are sold at low prices or have large install bases? What if users uninstall and reinstall games frequently?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;How will the fee impact Unity’s reputation and competitiveness? Will developers switch to other engines, such as Unreal Engine or Godot?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;How will the fee affect the quality and diversity of games made with Unity? Will developers avoid making innovative or experimental games that might attract a large audience?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;With the removal of Unity Plus, would that mean if developers want to remove Unity splash screen branding logo, they need to subscribe for Unity Pro ($2040/year)?&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The update is expected to take effect in January 2024, giving developers some time to adjust their plans and expectations. However, many developers are already unhappy and worried about the future of Unity and their games.&lt;/p&gt;

&lt;p&gt;TL;DR Keypoints:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The change doesn't really affect you if you are below threshold.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Will this fee apply to games using Unity Runtime that are already on the market on January 1, 2024&lt;/strong&gt;? Yes, the fee applies to eligible games currently in market that continue to distribute the runtime. They will look at a game's lifetime installs to determine eligibility for the runtime fee and bill the runtime fee based on all new installs that occur after January 1, 2024.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Unity Runtime Fee&lt;/strong&gt;: Starting from January 1, 2024, Unity will charge a small flat fee for each game install after the game has passed a minimum revenue and lifetime install threshold. The fee varies by region and subscription plan.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Unity Subscription Plans Update&lt;/strong&gt;: In November 2023, Unity will add new tools and services to its subscription plans at no extra cost. These include Unity DevOps, Unity Asset Manager, Unity Sentis, and Team Administration.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Unity Plus Retirement&lt;/strong&gt;: Unity Plus is no longer available for new subscribers as of September 12, 2023. Existing subscribers will receive an offer to upgrade to Unity Pro for one year at the same price.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;ul&gt;
&lt;li&gt;So, are you using Unity3D right now? &lt;/li&gt;
&lt;li&gt;What do you think about these upcoming changes? &lt;/li&gt;
&lt;li&gt;Any plans on looking into different Game Engine?&lt;/li&gt;
&lt;li&gt;Would you consider joining the &lt;a href="https://godot.community" rel="noopener noreferrer"&gt;Godot Community&lt;/a&gt;?&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;strong&gt;Update!&lt;/strong&gt;: Marc Whitten wrote a blog post in September 22, 2023 as an open letter to the Unity community.  &lt;/p&gt;

&lt;p&gt;Here are the main points from Marc Whitten's statement:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Runtime fee is here to stay, with extra caveats, self-reported, or you can switch to 2.5% revshare instead.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Marc apologized for not speaking with more users before announcing the new Runtime Fee policy. The goal of the policy was to support users today and invest in the Unity engine. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Unity Personal will remain free with no Runtime Fee for games built on it. The revenue cap is increasing from $100k to $200k and the Made with Unity splash screen will be removed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;No game with less than $1 million in trailing 12-month revenue will be subject to the fee.  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The Runtime Fee policy will only apply to the next LTS Unity version shipping in 2024. Games currently shipped and in development will not be included unless upgraded to the new version.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;For games subject to the fee, users can choose either a 2.5% revenue share or an amount based on new monthly active users. Both numbers are self-reported. Users will be billed the lesser amount.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Marc invited users to join a fireside chat at 4:00 pm ET to answer questions and provide more details.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Please refer to the official &lt;a href="https://blog.unity.com/news/open-letter-on-runtime-fee" rel="noopener noreferrer"&gt;blog post&lt;/a&gt; for more detail.&lt;/p&gt;

</description>
      <category>news</category>
      <category>unity3d</category>
      <category>gamedev</category>
      <category>discuss</category>
    </item>
    <item>
      <title>GDScript Cheatsheet</title>
      <dc:creator>Godot</dc:creator>
      <pubDate>Sun, 10 Sep 2023 21:01:43 +0000</pubDate>
      <link>https://dev.to/godot/gdscript-cheatsheet-5ghe</link>
      <guid>https://dev.to/godot/gdscript-cheatsheet-5ghe</guid>
      <description>&lt;p&gt;This cheatsheet is meant to be a handy reference for both beginners and experienced GDScript users. So, whether you're just starting out or looking to review up on your GDScript knowledge, this cheatsheet will be your go-to resource. We'll cover all the essential topics you need to know about GDScript, from basic syntax to advanced concepts, complete with code snippets and examples. So, let's get started!&lt;/p&gt;

&lt;h3&gt;
  
  
  Brief overview of GDScript
&lt;/h3&gt;

&lt;p&gt;GDScript is a high-level, both static and dynamically typed programming language specifically designed for the Godot game engine. It's easy to learn, especially if you're familiar with Python, as its syntax and structure are quite similar. GDScript is powerful and versatile, allowing you to create complex game logic with minimal effort.&lt;/p&gt;

&lt;p&gt;Some key benefits of using GDScript include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Tight integration with Godot's engine and editor&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Clear and concise syntax, allows you to focus on game development&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Designed for rapid prototyping and iteration&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Basic Syntax
&lt;/h2&gt;

&lt;p&gt;Let's begin by going over the basic syntax of GDScript. Here are the topics we'll cover:&lt;/p&gt;

&lt;h3&gt;
  
  
  Comments
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Single-line comments: &lt;code&gt;# This is a single-line comment&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Multi-line comments: For multi-line comments you need to prefix every line with &lt;code&gt;#&lt;/code&gt; hash, sadly in GDScript there's no easier way. Be careful with &lt;code&gt;"""&lt;/code&gt; three quotes &lt;code&gt;"""&lt;/code&gt; while it looks like multi-line comments, it's actually a multi-line strings and will be silently executed by the interpreter!&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="s2"&gt;"""
This is a multiline string, not a comment!
And thus it will be parsed by interpreter...
"""&lt;/span&gt;

&lt;span class="c1"&gt;# Now this&lt;/span&gt;
&lt;span class="c1"&gt;# is a multiline comments&lt;/span&gt;
&lt;span class="c1"&gt;# Interpreter will not read this&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Basic Output
&lt;/h3&gt;

&lt;p&gt;To print output in GDScript, use the &lt;code&gt;print()&lt;/code&gt; function:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Hello, Godot!"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Indentation
&lt;/h3&gt;

&lt;p&gt;GDScript uses indentation to define code blocks, just like Python:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;_init&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;pass&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Variables
&lt;/h3&gt;

&lt;p&gt;In GDScript, variables can be declared using the &lt;code&gt;var&lt;/code&gt; keyword. You can also specify the type of the variable using a colon (&lt;code&gt;:&lt;/code&gt;) followed by the type name.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Declare a variable: &lt;code&gt;var my_variable = 10&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Change the value of a variable: &lt;code&gt;my_variable = 20&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Declare a variable with a specific type: &lt;code&gt;var my_int: int = 5&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here are some common data types in GDScript:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;int&lt;/code&gt;: Integer numbers&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;float&lt;/code&gt;: Floating-point numbers&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;bool&lt;/code&gt;: Boolean values (&lt;code&gt;true&lt;/code&gt; or &lt;code&gt;false&lt;/code&gt;)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;String&lt;/code&gt;: Text strings&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;42&lt;/span&gt;
&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;3.14&lt;/span&gt;
&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;is_active&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;bool&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;true&lt;/span&gt;
&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"https://godot.community"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Arrays and Dictionaries
&lt;/h3&gt;

&lt;p&gt;GDScript also provides built-in data structures like arrays and dictionaries:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Array&lt;/code&gt;: Ordered list of elements&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Dictionary&lt;/code&gt;: Key-value pairs&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;my_array&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;Array&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;my_dict&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;Dictionary&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"key1"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"value1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"key2"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"value2"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Static Variables
&lt;/h3&gt;

&lt;p&gt;Static variables belong to a class rather than an instance of the class. To define a static variables, use the &lt;code&gt;static&lt;/code&gt; keyword:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Declare a static variable: &lt;code&gt;static var my_static_variable = 30&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Change the value of a static variable: &lt;code&gt;my_static_variable = 40&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Since statics belong to the class, you can also use &lt;code&gt;MyClass.my_static_variable = 40&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Constants
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Declare a constant: &lt;code&gt;const MY_CONSTANT = 100&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Operators
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Arithmetic
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Addition: &lt;code&gt;a + b&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Subtraction: &lt;code&gt;a - b&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Multiplication: &lt;code&gt;a * b&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Division: &lt;code&gt;a / b&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Modulus: &lt;code&gt;a % b&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Power: &lt;code&gt;a ** b&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Comparison
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Equal: &lt;code&gt;a == b&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Not equal: &lt;code&gt;a != b&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Less than: &lt;code&gt;a &amp;lt; b&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Less than or equal: &lt;code&gt;a &amp;lt;= b&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Greater than: &lt;code&gt;a &amp;gt; b&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Greater than or equal: &lt;code&gt;a &amp;gt;= b&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Logical
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;And: &lt;code&gt;a and b&lt;/code&gt; or &lt;code&gt;a &amp;amp;&amp;amp; b&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Or: &lt;code&gt;a or b&lt;/code&gt; or &lt;code&gt;a || b&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Not: &lt;code&gt;not a&lt;/code&gt; or &lt;code&gt;!a&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Bitwise
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Bitwise AND: &lt;code&gt;a &amp;amp; b&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Bitwise OR: &lt;code&gt;a | b&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Bitwise XOR: &lt;code&gt;a ^ b&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Bitwise NOT: &lt;code&gt;~a&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Left shift: &lt;code&gt;a &amp;lt;&amp;lt; b&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Right shift: &lt;code&gt;a &amp;gt;&amp;gt; b&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Assignment
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Assign: &lt;code&gt;a = b&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add and assign: &lt;code&gt;a += b&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Subtract and assign: &lt;code&gt;a -= b&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Multiply and assign: &lt;code&gt;a *= b&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Divide and assign: &lt;code&gt;a /= b&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Modulus and assign: &lt;code&gt;a %= b&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Power and assign: &lt;code&gt;a **= b&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Left shift and assign: &lt;code&gt;a &amp;lt;&amp;lt;= b&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Right shift and assign: &lt;code&gt;a &amp;gt;&amp;gt;= b&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Bitwise AND and assign: &lt;code&gt;a &amp;amp;= b&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Bitwise OR and assign: &lt;code&gt;a |= b&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Bitwise XOR and assign: &lt;code&gt;a ^= b&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Variable Typing
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Dynamic Typing
&lt;/h3&gt;

&lt;p&gt;In GDScript, variables are dynamically typed by default, meaning their type is interchangeable at runtime. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;my_variable&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;
&lt;span class="n"&gt;my_variable&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Hello, GDScript!"&lt;/span&gt; &lt;span class="c1"&gt;# This is allowed&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Static Typing
&lt;/h3&gt;

&lt;p&gt;Static typing can be used to explicitly specify the type of a variable, meaning their type is not interchangeable at runtime. This can help catch potential bugs and improve code readability:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;my_int&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;
&lt;span class="n"&gt;my_int&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Hello, GDScript!"&lt;/span&gt; &lt;span class="c1"&gt;# This will cause an error&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Static type can also be inferred by using &lt;code&gt;:=&lt;/code&gt; followed by value. Be careful when using this though, sometimes verbosity is better.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;my_int&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;
&lt;span class="n"&gt;my_int&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Hello World"&lt;/span&gt; &lt;span class="c1"&gt;# Error, because my_int has been statically inferred as int&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Control Structures
&lt;/h2&gt;

&lt;p&gt;Control structures are the building blocks of your GDScript code, allowing you to create complex logic and control the flow of your program. Let's learn about the different types of control structures in GDScript:&lt;/p&gt;

&lt;h3&gt;
  
  
  Conditional statements
&lt;/h3&gt;

&lt;h4&gt;
  
  
  If
&lt;/h4&gt;

&lt;p&gt;The &lt;code&gt;if&lt;/code&gt; statement is used to execute a block of code if a certain condition is true:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"x is positive"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Else
&lt;/h4&gt;

&lt;p&gt;The &lt;code&gt;else&lt;/code&gt; statement is used to execute a block of code if the condition in the &lt;code&gt;if&lt;/code&gt; statement is false:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"x is positive"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"x is not positive"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Elif
&lt;/h4&gt;

&lt;p&gt;The &lt;code&gt;elif&lt;/code&gt; (short for "else if") statement is used to test multiple conditions in a single &lt;code&gt;if&lt;/code&gt; statement:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"x is positive"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"x is negative"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"x is zero"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Loops
&lt;/h3&gt;

&lt;h4&gt;
  
  
  For
&lt;/h4&gt;

&lt;p&gt;The &lt;code&gt;for&lt;/code&gt; loop is used to iterate over a sequence, such as an array or a range of numbers:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;# Prints 0, 1, 2, 3, 4&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;my_array&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;# Prints each item in my_array&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  While
&lt;/h4&gt;

&lt;p&gt;The &lt;code&gt;while&lt;/code&gt; loop is used to repeatedly execute a block of code as long as a certain condition is true:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
&lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;# Prints 0, 1, 2, 3, 4&lt;/span&gt;
    &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Break and Continue
&lt;/h4&gt;

&lt;p&gt;The &lt;code&gt;break&lt;/code&gt; statement is used to exit a loop prematurely:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;break&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;# Prints 0, 1, 2, 3, 4&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;continue&lt;/code&gt; statement is used to skip the rest of the current iteration and proceed to the next one:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;continue&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;# Prints 0, 1, 3, 4&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Functions
&lt;/h2&gt;

&lt;p&gt;Functions are blocks of code that can be defined and called by name. They can take input, perform some action, and return a result. Let's learn how to work with functions in GDScript:&lt;/p&gt;

&lt;h3&gt;
  
  
  Defining functions
&lt;/h3&gt;

&lt;p&gt;To define a function, use the &lt;code&gt;func&lt;/code&gt; keyword followed by the function name and a pair of parentheses:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;my_function&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Hello, GDScript!"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Built-in functions
&lt;/h3&gt;

&lt;p&gt;GDScript comes with a variety of built-in functions that you can use in your code. Some examples include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;print()&lt;/code&gt;: Prints a message to the console&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;randi()&lt;/code&gt;: Returns a random integer&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;len()&lt;/code&gt;: Returns the length of a sequence (e.g., an array or a string)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Function arguments
&lt;/h3&gt;

&lt;p&gt;Functions can take input in the form of arguments. To define a function with arguments, include the argument names inside the parentheses:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also define the types of the arguments, it will spit out an error if you try to pass different types to the arguments.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Return values
&lt;/h3&gt;

&lt;p&gt;Functions can return a result using the &lt;code&gt;return&lt;/code&gt; keyword:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;

&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;# result is 5&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also define the type of the returned value by appending &lt;code&gt;-&amp;gt; ReturnType&lt;/code&gt; to the function declaration, it will spit out an error if you try to return something that isn't the correct type.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Returns integer&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;

&lt;span class="c1"&gt;# This won't work&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"Hello"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Optional argument values
&lt;/h3&gt;

&lt;p&gt;Functions can have optional argument as value by assigning it at the definition:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;multiply&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;

&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;multiply&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;# result is 6&lt;/span&gt;
&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;multiply&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;# result is 8&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: Optional arguments can only be positioned after you've defined all mandatory arguments.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Valid, optional placed last&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt;

&lt;span class="c1"&gt;# Invalid, can't have optional before mandatory&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Static Functions
&lt;/h3&gt;

&lt;p&gt;Static functions are functions that belong to a class rather than an instance of the class. To define a static function, use the &lt;code&gt;static&lt;/code&gt; keyword:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="k"&gt;class_name&lt;/span&gt;  &lt;span class="n"&gt;MyClass&lt;/span&gt; &lt;span class="k"&gt;extends&lt;/span&gt; &lt;span class="n"&gt;Node&lt;/span&gt;

&lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;my_static_function&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"This is a static function."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;_init&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;void&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;my_static_function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;MyClass&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;my_static_function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Since statics belong to the class, you can use &lt;code&gt;MyClass.my_static_function()&lt;/code&gt; to invoke it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Classes and Objects
&lt;/h2&gt;

&lt;p&gt;In GDScript, a script file represents a class and objects are instances of classes. You can create instances of a class using the &lt;code&gt;new()&lt;/code&gt; method.&lt;/p&gt;

&lt;h3&gt;
  
  
  Defining Classes
&lt;/h3&gt;

&lt;p&gt;To define a class, simply create a new script file (e.g., &lt;code&gt;my_class.gd&lt;/code&gt;). The name of the file should represents the name of the class. Create a new file called &lt;code&gt;player.gd&lt;/code&gt; with the following content:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="k"&gt;class_name&lt;/span&gt; &lt;span class="n"&gt;Player&lt;/span&gt;

&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;health&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;
&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Unnamed"&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;take_damage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;health&lt;/span&gt; &lt;span class="o"&gt;-=&lt;/span&gt; &lt;span class="n"&gt;amount&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;health&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Player"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"has died!"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Creating Object
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;player&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Player&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;new&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;player&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"John Doe"&lt;/span&gt;
&lt;span class="n"&gt;player&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;take_damage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Properties
&lt;/h3&gt;

&lt;p&gt;Properties are variables that belong to a class or an object. They can be used to store data or state:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;MyClass&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;my_property&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Methods
&lt;/h3&gt;

&lt;p&gt;Methods are functions that belong to a class or an object. They can be used to perform actions or manipulate data:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;MyClass&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;my_method&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
        &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Hello, GDScript!"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Inheritance
&lt;/h3&gt;

&lt;p&gt;Inheritance is a way for one class to inherit the properties and methods of another class. To inherit from another class, use the &lt;code&gt;extends&lt;/code&gt; keyword:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Derived class&lt;/span&gt;
&lt;span class="k"&gt;class_name&lt;/span&gt; &lt;span class="n"&gt;DerivedClass&lt;/span&gt; &lt;span class="k"&gt;extends&lt;/span&gt; &lt;span class="n"&gt;MyBaseClass&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;my_method&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Hello from the derived class!"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Constructors
&lt;/h3&gt;

&lt;p&gt;Constructors are special methods that are called when an object is initialized. In GDScript, the constructor is named &lt;code&gt;_init&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;MyClass&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;_init&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
        &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Object initialized!"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Signals and Events
&lt;/h2&gt;

&lt;p&gt;Signals are a way for objects to communicate with each other without relying on direct references. They can be used to decouple your code and make it more modular. Let's learn how to work with signals and events in GDScript:&lt;/p&gt;

&lt;h3&gt;
  
  
  Defining signals
&lt;/h3&gt;

&lt;p&gt;To define a signal, use the &lt;code&gt;signal&lt;/code&gt; keyword followed by the signal name:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="k"&gt;signal&lt;/span&gt; &lt;span class="n"&gt;my_signal&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Emitting signals
&lt;/h3&gt;

&lt;p&gt;To emit a signal, you can use the &lt;code&gt;emit_signal&lt;/code&gt; method:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="n"&gt;emit_signal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"my_signal"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;However, it's better to ditch those strings, by simply calling emit method inside the signal directly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="n"&gt;my_signal&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;emit&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Connecting signals to functions
&lt;/h3&gt;

&lt;p&gt;Signals are a way to communicate between objects in Godot. They allow you to decouple your code and create more modular systems.&lt;/p&gt;

&lt;p&gt;To connect a signal to a function, use the &lt;code&gt;connect&lt;/code&gt; method:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="n"&gt;my_object&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;my_signal&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;connect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;on_my_signal&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;on_my_signal&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Signal received!"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There are actually four ways to connect signals, however, this is the recommended approach, instead of the other one (That might more error prone).&lt;/p&gt;

&lt;h2&gt;
  
  
  Error Handling
&lt;/h2&gt;

&lt;p&gt;Error handling is an important aspect of programming, as it allows you to gracefully handle errors and exceptions that may occur at runtime. In GDScript, you can use the following constructs to handle errors:&lt;/p&gt;

&lt;h3&gt;
  
  
  Assert
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;assert&lt;/code&gt; statement is used to check if a condition is true, and if not, raise an error:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="nb"&gt;assert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"x must be positive"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: &lt;code&gt;assert&lt;/code&gt; is a utility function meant for unit tests. Code inside assert is only executed in debug builds or when running the project from the editor.&lt;/p&gt;

&lt;h3&gt;
  
  
  Try, Catch, and Throw
&lt;/h3&gt;

&lt;p&gt;GDScript does not have built-in support for try-catch blocks. There are many godot-proposals from people asking for it, however, It has already been stated that try-catch will never come into gdscript.&lt;/p&gt;

&lt;p&gt;Quoting from Juan in &lt;a href="https://github.com/godotengine/godot/issues/3516#issuecomment-177152034" rel="noopener noreferrer"&gt;his post&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Exceptions won't happen. Godot is designed for things to keep working even if state is inconsistent, while at the same time reporting errors&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  File I/O
&lt;/h2&gt;

&lt;p&gt;Working with files is a common task in many applications. In GDScript, you can use the &lt;code&gt;File&lt;/code&gt; class to read from and write to files:&lt;/p&gt;

&lt;h3&gt;
  
  
  Writing a file
&lt;/h3&gt;

&lt;p&gt;To write to a file, use the &lt;code&gt;store_string&lt;/code&gt;, &lt;code&gt;store_line&lt;/code&gt; or other &lt;code&gt;store_*&lt;/code&gt; methods:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;player_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Septian"&lt;/span&gt;
&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;file&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;FileAccess&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"user://save_game.dat"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;FileAccess&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;WRITE&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;store_string&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;player_name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Reading and writing
&lt;/h3&gt;

&lt;p&gt;To read from a file, use the &lt;code&gt;get_as_text&lt;/code&gt; or other &lt;code&gt;get_*&lt;/code&gt; method:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;file&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;FileAccess&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"user://save_game.dat"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;FileAccess&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;READ&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;player_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;get_as_text&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;player_name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Closing files
&lt;/h3&gt;

&lt;p&gt;To close a file, use the &lt;code&gt;close&lt;/code&gt; method:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;close&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;FileAccess&lt;/code&gt; will automatically closes the file when it goes out of scope or set to null. However it's better to be explicit when handling with I/O.&lt;/p&gt;

&lt;h2&gt;
  
  
  Useful Tips and Tricks
&lt;/h2&gt;

&lt;p&gt;Here are some handy tips and tricks to help you write better GDScript:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Use clear and descriptive variable and function names&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Keep your functions short and focused&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use comments to explain complex or important code&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Follow the &lt;a href="https://godot.community/topic/27/gdscript-coding-conventions-best-practices-for-readable-and-maintainable-code" rel="noopener noreferrer"&gt;GDScript style guide&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Follow the &lt;a href="https://godot.community/topic/41/gdscript-best-practices-for-organized-code" rel="noopener noreferrer"&gt;GDScript code ordering&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  String manipulation
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;String interpolation:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"The &lt;/span&gt;&lt;span class="si"&gt;%s&lt;/span&gt;&lt;span class="s2"&gt; has defeated the &lt;/span&gt;&lt;span class="si"&gt;%s&lt;/span&gt;&lt;span class="s2"&gt; in &lt;/span&gt;&lt;span class="si"&gt;%s&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Player"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Boss"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Combat"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# Will prints:&lt;/span&gt;
&lt;span class="c1"&gt;# The Player has defeated the Boss in Combat&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Concatenate strings: &lt;code&gt;var result = "Hello, " + "GDScript!"&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Format strings: &lt;code&gt;var result = "Hello, %s!" % "GDScript"&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Split strings: &lt;code&gt;var words = "Hello, GDScript!".split(", ")&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Array and Dictionary operations
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Add an item to an array: &lt;code&gt;my_array.append(item)&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Remove an item from an array: &lt;code&gt;my_array.erase(item)&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Get the length of an array: &lt;code&gt;var length = my_array.size()&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Check if a key exists in a dictionary: &lt;code&gt;if my_dict.has(key):&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Type casting
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Cast a value to a specific type: &lt;code&gt;var my_int = int("42")&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Debugging
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Print a message to the console: &lt;code&gt;print("Hello, GDScript!")&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Set a breakpoint: &lt;code&gt;breakpoint&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Resources
&lt;/h2&gt;

&lt;p&gt;To learn more about GDScript and the Godot game engine, check out these great resources:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://godot.community/category/22/ask" rel="noopener noreferrer"&gt;Ask Godot Community&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://godot.community/category/24/beginner-s-corner" rel="noopener noreferrer"&gt;Beginner's Corners&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://godot.community/tags/tutorial" rel="noopener noreferrer"&gt;Tutorials tagged posts&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That's it for this &lt;strong&gt;GDScript Cheatsheet&lt;/strong&gt;! I hope you found it useful and informative. Feel free to bookmark this post and refer back to it whenever you need a quick reference for GDScript. Happy coding!&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This cheatsheet is updated for Godot 4.2, GDScript is an evolving language, if you find outdated information, please let me know so I can fix it! &lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>programming</category>
      <category>tutorial</category>
      <category>beginners</category>
      <category>gdscript</category>
    </item>
    <item>
      <title>Learn C++: An Introduction for Beginners</title>
      <dc:creator>Godot</dc:creator>
      <pubDate>Sat, 09 Sep 2023 08:32:02 +0000</pubDate>
      <link>https://dev.to/godot/learn-c-an-introduction-for-beginners-2m06</link>
      <guid>https://dev.to/godot/learn-c-an-introduction-for-beginners-2m06</guid>
      <description>&lt;p&gt;&lt;strong&gt;C++&lt;/strong&gt; is a powerful, versatile, and widely-used programming language that has remained relevant in the world of software development for over three decades. In this short post, we'll introduce you to the basics of C++ and help you build a strong foundation to embark on your programming journey.&lt;/p&gt;

&lt;h3&gt;
  
  
  Brief history of C++
&lt;/h3&gt;

&lt;p&gt;C++ was created by &lt;strong&gt;Bjarne Stroustrup&lt;/strong&gt; in 1985 as an extension of the C programming language. Stroustrup wanted to add object-oriented features to C, which led to the birth of C++. Since then, C++ has undergone several revisions and updates, with the most recent version being C++20.&lt;/p&gt;

&lt;h3&gt;
  
  
  Importance of C++ in modern programming
&lt;/h3&gt;

&lt;p&gt;C++ is an essential language in today's programming landscape for several reasons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It is highly efficient and provides fine-grained control over system resources.&lt;/li&gt;
&lt;li&gt;It supports both procedural and object-oriented programming paradigms.&lt;/li&gt;
&lt;li&gt;It has a vast standard library (STL) that simplifies complex tasks.&lt;/li&gt;
&lt;li&gt;It is widely used in industries such as &lt;a href="https://dev.to/t/gamedev"&gt;game development&lt;/a&gt;, embedded systems, and high-performance computing.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Overview of the post
&lt;/h3&gt;

&lt;p&gt;This post is divided into several sections, each focusing on key aspects of C++ programming:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Setting up the environment&lt;/li&gt;
&lt;li&gt;Basic C++ syntax&lt;/li&gt;
&lt;li&gt;Functions&lt;/li&gt;
&lt;li&gt;Object-oriented programming&lt;/li&gt;
&lt;li&gt;Standard Template Library (STL)&lt;/li&gt;
&lt;li&gt;Input and output&lt;/li&gt;
&lt;li&gt;Error handling&lt;/li&gt;
&lt;li&gt;Advanced topics&lt;/li&gt;
&lt;li&gt;Best practices and debugging&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;By the end of this post, you'll have a solid understanding of C++ fundamentals and be ready to tackle more advanced topics.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting up the environment
&lt;/h2&gt;

&lt;p&gt;Before we start coding, let's set up our development environment.&lt;/p&gt;

&lt;h3&gt;
  
  
  Choosing an IDE
&lt;/h3&gt;

&lt;p&gt;An Integrated Development Environment (IDE) is a software application that provides a comprehensive set of tools for coding, debugging, and building software. Some popular C++ IDEs include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Visual Studio&lt;/strong&gt;: A powerful and feature-rich IDE from Microsoft.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Code::Blocks&lt;/strong&gt;: A free, open-source, and cross-platform IDE.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CLion&lt;/strong&gt;: A commercial IDE from JetBrains with advanced features and excellent support.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Choose the IDE that best fits your needs and preferences.&lt;/p&gt;

&lt;h3&gt;
  
  
  Installing the compiler
&lt;/h3&gt;

&lt;p&gt;A compiler is a program that translates your C++ code into machine code, which can then be executed by a computer. Some common C++ compilers are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GCC&lt;/strong&gt;: The GNU Compiler Collection is a widely-used, open-source compiler that supports multiple platforms.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Clang&lt;/strong&gt;: A compiler based on LLVM, known for its fast compilation times and helpful error messages.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Microsoft Visual C++&lt;/strong&gt;: A compiler included with Visual Studio, optimized for Windows development.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Install the compiler that is compatible with your chosen IDE and operating system.&lt;/p&gt;

&lt;h3&gt;
  
  
  Creating your first C++ project
&lt;/h3&gt;

&lt;p&gt;Once you have your IDE and compiler set up, it's time to create your first C++ project. Follow these general steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open your chosen IDE and create a new project.&lt;/li&gt;
&lt;li&gt;Select "C++" as the project type.&lt;/li&gt;
&lt;li&gt;Choose a name and location for your project.&lt;/li&gt;
&lt;li&gt;Add a new C++ source file to your project (usually with a &lt;code&gt;.cpp&lt;/code&gt; extension).&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Basic C++ syntax
&lt;/h2&gt;

&lt;p&gt;Now that we have our environment set up, let's dive into the basics of C++ syntax.&lt;/p&gt;

&lt;h3&gt;
  
  
  Structure of a C++ program
&lt;/h3&gt;

&lt;p&gt;A typical C++ program consists of the following elements:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Preprocessor directives&lt;/strong&gt;: These are commands that instruct the compiler to perform specific tasks before compiling the code. For example, &lt;code&gt;#include&lt;/code&gt; is used to include header files.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Function declarations and definitions&lt;/strong&gt;: These are used to declare and define functions, which are blocks of code that perform specific tasks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Variables and data types&lt;/strong&gt;: These are used to store and manipulate data in your program.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Control structures&lt;/strong&gt;: These are used to control the flow of your program, such as &lt;code&gt;if&lt;/code&gt;, &lt;code&gt;else&lt;/code&gt;, and &lt;code&gt;switch&lt;/code&gt; statements.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Loops&lt;/strong&gt;: These are used to repeatedly execute blocks of code, such as &lt;code&gt;for&lt;/code&gt;, &lt;code&gt;while&lt;/code&gt;, and &lt;code&gt;do-while&lt;/code&gt; loops.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here's a simple example of a C++ program:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="cp"&gt;#include&lt;/span&gt; &lt;span class="cpf"&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;span class="cp"&gt;
&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;cout&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="s"&gt;"Hello, World!"&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;endl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Variables and data types
&lt;/h3&gt;

&lt;p&gt;In C++, we use variables to store and manipulate data. Each variable has a specific data type that determines the kind of data it can hold. Some common C++ data types are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;int&lt;/strong&gt;: Integer values (e.g., -2, 0, 42)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;float&lt;/strong&gt;: Single-precision floating-point values (e.g., 3.14f, -0.001f)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;double&lt;/strong&gt;: Double-precision floating-point values (e.g., 3.141592653589793, -0.000001)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;char&lt;/strong&gt;: Single characters (e.g., 'a', 'Z', '9')&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;bool&lt;/strong&gt;: Boolean values (true or false)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here's an example of declaring and initializing variables in C++:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;age&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;weight&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;65.5&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="n"&gt;pi&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;3.141592653589793&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kt"&gt;char&lt;/span&gt; &lt;span class="n"&gt;initial&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sc"&gt;'A'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kt"&gt;bool&lt;/span&gt; &lt;span class="n"&gt;is_adult&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Operators and expressions
&lt;/h3&gt;

&lt;p&gt;Operators are special symbols that perform operations on operands (variables or values). Some common C++ operators are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Arithmetic operators&lt;/strong&gt;: &lt;code&gt;+&lt;/code&gt;, &lt;code&gt;-&lt;/code&gt;, &lt;code&gt;*&lt;/code&gt;, &lt;code&gt;/&lt;/code&gt;, &lt;code&gt;%&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Relational operators&lt;/strong&gt;: &lt;code&gt;&amp;lt;&lt;/code&gt;, &lt;code&gt;&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;=&lt;/code&gt;, &lt;code&gt;&amp;gt;=&lt;/code&gt;, &lt;code&gt;==&lt;/code&gt;, &lt;code&gt;!=&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Logical operators&lt;/strong&gt;: &lt;code&gt;&amp;amp;&amp;amp;&lt;/code&gt;, &lt;code&gt;||&lt;/code&gt;, &lt;code&gt;!&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Expressions are combinations of variables, values, and operators that result in a single value. Here's an example of using operators and expressions in C++:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;sum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kt"&gt;bool&lt;/span&gt; &lt;span class="n"&gt;is_greater&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Control structures (if, else, switch)
&lt;/h3&gt;

&lt;p&gt;Control structures are used to control the flow of your program based on certain conditions. Some common C++ control structures are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;if&lt;/strong&gt;: Executes a block of code if a specified condition is true.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;else&lt;/strong&gt;: Executes a block of code if the condition in the preceding &lt;code&gt;if&lt;/code&gt; statement is false.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;switch&lt;/strong&gt;: Executes a block of code based on the value of a specified expression.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here's an example of using control structures in C++:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;42&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;cout&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="s"&gt;"x is positive"&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;endl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;cout&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="s"&gt;"x is non-positive"&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;endl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;switch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;cout&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="s"&gt;"x is even"&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;endl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;cout&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="s"&gt;"x is odd"&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;endl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Loops (for, while, do-while)
&lt;/h3&gt;

&lt;p&gt;Loops are used to repeatedly execute blocks of code based on certain conditions. Some common C++ loops are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;for&lt;/strong&gt;: Executes a block of code a specified number of times.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;while&lt;/strong&gt;: Executes a block of code as long as a specified condition is true.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;do-while&lt;/strong&gt;: Executes a block of code at least once and then repeatedly as long as a specified condition is true.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here's an example of using loops in C++:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="c1"&gt;// for loop&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;cout&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;endl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// while loop&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;count&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;count&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;cout&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;count&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;endl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="n"&gt;count&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// do-while loop&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;num&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;cout&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="s"&gt;"Enter a positive number: "&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;cin&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;num&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;num&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Functions
&lt;/h2&gt;

&lt;p&gt;Functions are blocks of code that perform specific tasks and can be called by name. They can accept input (parameters) and return output (return values).&lt;/p&gt;

&lt;h3&gt;
  
  
  Defining and declaring functions
&lt;/h3&gt;

&lt;p&gt;Functions are defined using the following syntax:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="n"&gt;return_type&lt;/span&gt; &lt;span class="nf"&gt;function_name&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;parameter_list&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// function body&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For example, here's a simple function that adds two numbers and returns the result:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Function declarations (also called prototypes) are used to inform the compiler about a function's existence before it is defined. They have the following syntax:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="n"&gt;return_type&lt;/span&gt; &lt;span class="nf"&gt;function_name&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;parameter_list&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For example, here's the declaration for the &lt;code&gt;add&lt;/code&gt; function:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Function parameters and return values
&lt;/h3&gt;

&lt;p&gt;Function parameters are variables that hold the input values passed to the function. They are specified in the function definition and declaration.&lt;/p&gt;

&lt;p&gt;Return values are the output values produced by the function. They are specified using the &lt;code&gt;return&lt;/code&gt; statement followed by an expression or value.&lt;/p&gt;

&lt;p&gt;Here's an example of a function that calculates the area of a rectangle:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="nf"&gt;area&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="n"&gt;length&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="n"&gt;width&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;length&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;width&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Function overloading
&lt;/h3&gt;

&lt;p&gt;Function overloading is the ability to define multiple functions with the same name but different parameter lists. The compiler chooses the appropriate function to call based on the number and types of arguments passed.&lt;/p&gt;

&lt;p&gt;Here's an example of function overloading:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Recursion
&lt;/h3&gt;

&lt;p&gt;Recursion is the process of a function calling itself, either directly or indirectly. It is often used to solve problems that can be broken down into smaller, similar problems.&lt;/p&gt;

&lt;p&gt;Here's an example of a recursive function that calculates the factorial of a number:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;factorial&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nf"&gt;factorial&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Object-oriented programming
&lt;/h2&gt;

&lt;p&gt;Object-oriented programming (OOP) is a programming paradigm that focuses on organizing code into "objects" that represent real-world entities. It is built on the concepts of classes, objects, inheritance, and polymorphism.&lt;/p&gt;

&lt;h3&gt;
  
  
  Introduction to OOP concepts
&lt;/h3&gt;

&lt;p&gt;The main concepts in OOP are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Classes&lt;/strong&gt;: Templates for creating objects, consisting of data members and member functions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Objects&lt;/strong&gt;: Instances of classes, representing real-world entities.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Inheritance&lt;/strong&gt;: The process of creating new classes that inherit the properties and methods of existing classes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Polymorphism&lt;/strong&gt;: The ability of a function or method to operate on multiple types of data or objects.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Classes and objects
&lt;/h3&gt;

&lt;p&gt;Classes are defined using the &lt;code&gt;class&lt;/code&gt; keyword, followed by the class name and a set of braces containing the class's data members and member functions.&lt;/p&gt;

&lt;p&gt;Objects are instances of classes, created using the class's constructor.&lt;/p&gt;

&lt;p&gt;Here's an example of a class definition and object creation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Dog&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="nl"&gt;public:&lt;/span&gt;
  &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;age&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;bark&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;cout&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="s"&gt;"Woof!"&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;endl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;Dog&lt;/span&gt; &lt;span class="n"&gt;my_dog&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;my_dog&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Buddy"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;my_dog&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;age&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;my_dog&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;bark&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Constructors and destructors
&lt;/h3&gt;

&lt;p&gt;Constructors are special member functions that are called when an object is created. They are used to initialize the object's data members. Destructors are special member functions that are called when an object is destroyed. They are used to perform any necessary cleanup.&lt;/p&gt;

&lt;p&gt;Here's an example of a class with constructors and a destructor:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Dog&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="nl"&gt;public:&lt;/span&gt;
  &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;age&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="c1"&gt;// Default constructor&lt;/span&gt;
  &lt;span class="n"&gt;Dog&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Unnamed"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;age&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;

  &lt;span class="c1"&gt;// Parameterized constructor&lt;/span&gt;
  &lt;span class="n"&gt;Dog&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;age&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;

  &lt;span class="c1"&gt;// Destructor&lt;/span&gt;
  &lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="n"&gt;Dog&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;cout&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="s"&gt;"Dog destroyed"&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;endl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;bark&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;cout&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="s"&gt;"Woof!"&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;endl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Inheritance
&lt;/h3&gt;

&lt;p&gt;Inheritance is the process of creating new classes that inherit the properties and methods of existing classes. It allows for code reuse and modular design.&lt;/p&gt;

&lt;p&gt;Here's an example of inheritance in C++:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Animal&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="nl"&gt;public:&lt;/span&gt;
  &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;age&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;make_sound&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;cout&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="s"&gt;"Generic animal sound"&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;endl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Dog&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="n"&gt;Animal&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="nl"&gt;public:&lt;/span&gt;
  &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;make_sound&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;cout&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="s"&gt;"Woof!"&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;endl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Polymorphism
&lt;/h3&gt;

&lt;p&gt;Polymorphism is the ability of a function or method to operate on multiple types of data or objects. It allows for more flexible and modular code.&lt;/p&gt;

&lt;p&gt;Here's an example of polymorphism in C++:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Animal&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="nl"&gt;public:&lt;/span&gt;
  &lt;span class="k"&gt;virtual&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;make_sound&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;cout&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="s"&gt;"Generic animal sound"&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;endl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Dog&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="n"&gt;Animal&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="nl"&gt;public:&lt;/span&gt;
  &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;make_sound&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;cout&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="s"&gt;"Woof!"&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;endl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Cat&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="n"&gt;Animal&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="nl"&gt;public:&lt;/span&gt;
  &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;make_sound&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;cout&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="s"&gt;"Meow!"&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;endl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;Animal&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;animals&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;Dog&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;Cat&lt;/span&gt;&lt;span class="p"&gt;()};&lt;/span&gt;
  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Animal&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;animal&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;animals&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;animal&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;make_sound&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Standard Template Library (STL)
&lt;/h2&gt;

&lt;p&gt;The Standard Template Library (STL) is a collection of template classes and functions that provide common data structures and algorithms for C++ programming.&lt;/p&gt;

&lt;h3&gt;
  
  
  Overview of STL
&lt;/h3&gt;

&lt;p&gt;The main components of the STL are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Containers&lt;/strong&gt;: Data structures that store and organize data (e.g., vector, list, map).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Iterators&lt;/strong&gt;: Objects that provide a way to access and traverse container elements.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Algorithms&lt;/strong&gt;: Functions that perform operations on containers (e.g., sorting, searching).&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Containers (vector, list, map, etc.)
&lt;/h3&gt;

&lt;p&gt;Containers are data structures that store and organize data. Some common STL containers are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;vector&lt;/strong&gt;: A dynamic array that can grow or shrink in size.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;list&lt;/strong&gt;: A doubly-linked list that allows for efficient insertions and deletions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;map&lt;/strong&gt;: An associative container that stores key-value pairs, with unique keys.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here's an example of using a vector container in C++:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="cp"&gt;#include&lt;/span&gt; &lt;span class="cpf"&gt;&amp;lt;vector&amp;gt;&lt;/span&gt;&lt;span class="cp"&gt;
&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;vector&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;numbers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;};&lt;/span&gt;

  &lt;span class="n"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;push_back&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Add an element to the end&lt;/span&gt;
  &lt;span class="n"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;pop_back&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// Remove the last element&lt;/span&gt;
  &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;first&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;front&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// Get the first element&lt;/span&gt;
  &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;last&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;back&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// Get the last element&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Iterators
&lt;/h3&gt;

&lt;p&gt;Iterators are objects that provide a way to access and traverse container elements. They are similar to pointers but are more flexible and can work with different container types.&lt;/p&gt;

&lt;p&gt;Here's an example of using iterators with a vector container:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="cp"&gt;#include&lt;/span&gt; &lt;span class="cpf"&gt;&amp;lt;vector&amp;gt;&lt;/span&gt;&lt;span class="cp"&gt;
&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;vector&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;numbers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;};&lt;/span&gt;
  &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;vector&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;::&lt;/span&gt;&lt;span class="n"&gt;iterator&lt;/span&gt; &lt;span class="n"&gt;it&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;it&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;begin&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="n"&gt;it&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="n"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;end&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="n"&gt;it&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;cout&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;it&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;endl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Algorithms
&lt;/h3&gt;

&lt;p&gt;Algorithms are functions that perform operations on containers, such as sorting, searching, and transforming data.&lt;/p&gt;

&lt;p&gt;Here's an example of using the &lt;code&gt;sort&lt;/code&gt; algorithm with a vector container:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="cp"&gt;#include&lt;/span&gt; &lt;span class="cpf"&gt;&amp;lt;vector&amp;gt;&lt;/span&gt;&lt;span class="cp"&gt;
#include&lt;/span&gt; &lt;span class="cpf"&gt;&amp;lt;algorithm&amp;gt;&lt;/span&gt;&lt;span class="cp"&gt;
&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;vector&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;numbers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;};&lt;/span&gt;
  &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;sort&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;begin&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;end&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt; &lt;span class="c1"&gt;// Sort the vector in ascending order&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Input and output
&lt;/h2&gt;

&lt;p&gt;C++ provides several ways to handle input and output, including console input/output, file input/output, and string manipulation.&lt;/p&gt;

&lt;h3&gt;
  
  
  Console input and output
&lt;/h3&gt;

&lt;p&gt;Console input and output are performed using the &lt;code&gt;cin&lt;/code&gt; and &lt;code&gt;cout&lt;/code&gt; objects, which are part of the &lt;code&gt;iostream&lt;/code&gt; library. They allow you to read and write data to and from the console.&lt;/p&gt;

&lt;p&gt;Here's an example of using console input and output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="cp"&gt;#include&lt;/span&gt; &lt;span class="cpf"&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;span class="cp"&gt;
&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;age&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;cout&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="s"&gt;"Enter your age: "&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;cin&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;age&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;cout&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="s"&gt;"You are "&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;age&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="s"&gt;" years old"&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;endl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  File input and output
&lt;/h3&gt;

&lt;p&gt;File input and output are performed using the &lt;code&gt;ifstream&lt;/code&gt; and &lt;code&gt;ofstream&lt;/code&gt; classes, which are part of the &lt;code&gt;fstream&lt;/code&gt; library. They allow you to read and write data to and from files.&lt;/p&gt;

&lt;p&gt;Here's an example of using file input and output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="cp"&gt;#include&lt;/span&gt; &lt;span class="cpf"&gt;&amp;lt;fstream&amp;gt;&lt;/span&gt;&lt;span class="cp"&gt;
#include&lt;/span&gt; &lt;span class="cpf"&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;span class="cp"&gt;
&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;ofstream&lt;/span&gt; &lt;span class="n"&gt;outfile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"output.txt"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="n"&gt;outfile&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="s"&gt;"Hello, file!"&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;endl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;outfile&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;close&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

  &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;ifstream&lt;/span&gt; &lt;span class="n"&gt;infile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"output.txt"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;getline&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;infile&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;cout&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;endl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;infile&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;close&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  String manipulation
&lt;/h3&gt;

&lt;p&gt;String manipulation is performed using the &lt;code&gt;string&lt;/code&gt; class, which is part of the &lt;code&gt;string&lt;/code&gt; library. It provides various functions and operators for working with strings.&lt;/p&gt;

&lt;p&gt;Here's an example of using string manipulation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="cp"&gt;#include&lt;/span&gt; &lt;span class="cpf"&gt;&amp;lt;string&amp;gt;&lt;/span&gt;&lt;span class="cp"&gt;
#include&lt;/span&gt; &lt;span class="cpf"&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;span class="cp"&gt;
&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt; &lt;span class="n"&gt;greeting&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Hello, World!"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"John"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt; &lt;span class="n"&gt;personalized_greeting&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;greeting&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s"&gt;" "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;cout&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;personalized_greeting&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;endl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Error handling
&lt;/h2&gt;

&lt;p&gt;Error handling is an essential aspect of programming that helps you deal with unexpected situations and prevent your program from crashing. In C++, error handling is primarily done using exceptions.&lt;/p&gt;

&lt;h3&gt;
  
  
  Exceptions
&lt;/h3&gt;

&lt;p&gt;Exceptions are events that occur during the execution of a program when an error is encountered. They are thrown using the &lt;code&gt;throw&lt;/code&gt; keyword and caught using &lt;code&gt;try&lt;/code&gt; and &lt;code&gt;catch&lt;/code&gt; blocks.&lt;/p&gt;

&lt;p&gt;Here's an example of using exceptions for error handling:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="cp"&gt;#include&lt;/span&gt; &lt;span class="cpf"&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;span class="cp"&gt;
&lt;/span&gt;
&lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="nf"&gt;divide&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="s"&gt;"Division by zero"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;divide&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;cout&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="s"&gt;"Result: "&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;endl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="kt"&gt;char&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;cout&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="s"&gt;"Error: "&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;error&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;endl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Try, catch, and throw
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;try&lt;/code&gt;, &lt;code&gt;catch&lt;/code&gt;, and &lt;code&gt;throw&lt;/code&gt; keywords are used to handle exceptions in C++.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;try&lt;/strong&gt;: Encloses a block of code that might throw an exception.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;catch&lt;/strong&gt;: Defines a block of code that handles a specific type of exception.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;throw&lt;/strong&gt;: Throws an exception when an error is encountered.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Custom exception classes
&lt;/h3&gt;

&lt;p&gt;You can create custom exception classes by inheriting from the &lt;code&gt;std::exception&lt;/code&gt; class and overriding its &lt;code&gt;what()&lt;/code&gt; method.&lt;/p&gt;

&lt;p&gt;Here's an example of creating a custom exception class:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="cp"&gt;#include&lt;/span&gt; &lt;span class="cpf"&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;span class="cp"&gt;
#include&lt;/span&gt; &lt;span class="cpf"&gt;&amp;lt;stdexcept&amp;gt;&lt;/span&gt;&lt;span class="cp"&gt;
&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;DivisionByZeroException&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;exception&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="nl"&gt;public:&lt;/span&gt;
  &lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="kt"&gt;char&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;what&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="k"&gt;noexcept&lt;/span&gt; &lt;span class="k"&gt;override&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s"&gt;"Division by zero"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="nf"&gt;divide&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="n"&gt;DivisionByZeroException&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;divide&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;cout&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="s"&gt;"Result: "&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;endl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="n"&gt;DivisionByZeroException&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;ex&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;cout&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="s"&gt;"Error: "&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;ex&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;what&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;endl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Advanced topics
&lt;/h2&gt;

&lt;p&gt;Now that we've covered the fundamentals, let's dive into some advanced C++ topics.&lt;/p&gt;

&lt;h3&gt;
  
  
  Pointers and memory management
&lt;/h3&gt;

&lt;p&gt;Pointers are variables that store the memory address of another variable. They are used to access and manipulate memory directly, providing greater flexibility and control over your program's resources.&lt;/p&gt;

&lt;p&gt;Here's an example of using pointers in C++:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;42&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// p points to the memory address of x&lt;/span&gt;
&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Change the value of x through the pointer&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Memory management is the process of allocating and deallocating memory as needed by your program. In C++, you can use the &lt;code&gt;new&lt;/code&gt; and &lt;code&gt;delete&lt;/code&gt; operators to allocate and deallocate memory dynamically.&lt;/p&gt;

&lt;p&gt;Here's an example of memory management in C++:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Allocate memory for an int&lt;/span&gt;
&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;42&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Assign a value to the memory&lt;/span&gt;
&lt;span class="k"&gt;delete&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Deallocate the memory&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Templates
&lt;/h3&gt;

&lt;p&gt;Templates are a powerful feature of C++ that allows you to write generic code that can work with different data types. They are used to create reusable classes and functions that can operate on any data type.&lt;/p&gt;

&lt;p&gt;Here's an example of using templates in C++:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="k"&gt;template&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="k"&gt;typename&lt;/span&gt; &lt;span class="nc"&gt;T&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="n"&gt;T&lt;/span&gt; &lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;T&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;T&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;add&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;add&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;double&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;3.14&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;2.71&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Lambda expressions
&lt;/h3&gt;

&lt;p&gt;Lambda expressions are a concise way to create anonymous functions (functions without a name). They are useful for creating short, one-time-use functions that can be passed as arguments to other functions.&lt;/p&gt;

&lt;p&gt;Here's an example of using a lambda expression in C++:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="cp"&gt;#include&lt;/span&gt; &lt;span class="cpf"&gt;&amp;lt;algorithm&amp;gt;&lt;/span&gt;&lt;span class="cp"&gt;
#include&lt;/span&gt; &lt;span class="cpf"&gt;&amp;lt;vector&amp;gt;&lt;/span&gt;&lt;span class="cp"&gt;
&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;vector&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;numbers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;};&lt;/span&gt;
  &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;sort&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;begin&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;end&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="p"&gt;[](&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt; &lt;span class="c1"&gt;// Sort in descending order using a lambda&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Multithreading
&lt;/h3&gt;

&lt;p&gt;Multithreading is the process of executing multiple threads concurrently, allowing your program to perform multiple tasks simultaneously. C++ provides the &lt;code&gt;&amp;lt;thread&amp;gt;&lt;/code&gt; library to work with threads.&lt;/p&gt;

&lt;p&gt;Here's an example of using multithreading in C++:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="cp"&gt;#include&lt;/span&gt; &lt;span class="cpf"&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;span class="cp"&gt;
#include&lt;/span&gt; &lt;span class="cpf"&gt;&amp;lt;thread&amp;gt;&lt;/span&gt;&lt;span class="cp"&gt;
&lt;/span&gt;
&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;print_hello&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;cout&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="s"&gt;"Hello from thread!"&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;endl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="kr"&gt;thread&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;print_hello&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;join&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// Wait for the thread to finish&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Best practices and debugging
&lt;/h2&gt;

&lt;p&gt;Writing clean, efficient, and maintainable code is essential for any programmer. In this section, we'll discuss best practices and debugging techniques for C++ programming.&lt;/p&gt;

&lt;h3&gt;
  
  
  Code organization
&lt;/h3&gt;

&lt;p&gt;Organizing your code into separate functions, classes, and files makes it easier to read, understand, and maintain.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Functions&lt;/strong&gt;: Break your code into small, reusable functions that perform specific tasks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Classes&lt;/strong&gt;: Organize related data and functions into classes to model real-world entities.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Files&lt;/strong&gt;: Separate your code into different files based on their functionality, and use header files for declarations.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Naming conventions
&lt;/h3&gt;

&lt;p&gt;Using consistent naming conventions for variables, functions, and classes makes your code easier to read and understand.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Variables&lt;/strong&gt;: Use lowercase letters and underscores (e.g., &lt;code&gt;my_variable&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Functions&lt;/strong&gt;: Use lowercase letters and underscores (e.g., &lt;code&gt;my_function&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Classes&lt;/strong&gt;: Use PascalCase (e.g., &lt;code&gt;MyClass&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Debugging techniques
&lt;/h3&gt;

&lt;p&gt;Debugging is the process of finding and fixing errors in your code. Some common debugging techniques include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Code review&lt;/strong&gt;: Review your code for syntax errors, logic errors, and other issues.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Print statements&lt;/strong&gt;: Add print statements to your code to display variable values and track the program's execution.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Breakpoints&lt;/strong&gt;: Use breakpoints in your IDE to pause the execution of your program and inspect its state.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Step-through debugging&lt;/strong&gt;: Use step-through debugging in your IDE to execute your program one line at a time and observe its behavior.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Performance optimization
&lt;/h3&gt;

&lt;p&gt;Optimizing your code for performance can help your program run faster and use fewer resources. Some general performance optimization tips include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Use efficient algorithms&lt;/strong&gt;: Choose algorithms with lower time complexity to reduce the execution time of your program.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Minimize memory usage&lt;/strong&gt;: Use appropriate data structures and memory allocation techniques to minimize memory usage.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Profile your code&lt;/strong&gt;: Use profiling tools to identify performance bottlenecks in your code and optimize them.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Congratulations! You've now learned the fundamentals of C++ programming, including setting up your development environment, understanding basic syntax, working with functions and classes, using the Standard Template Library, handling input and output, and more.&lt;/p&gt;

&lt;h3&gt;
  
  
  Review of key concepts
&lt;/h3&gt;

&lt;p&gt;Here's a quick review of some key concepts we covered:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;C++ is a powerful, versatile, and widely-used programming language.&lt;/li&gt;
&lt;li&gt;It supports both procedural and object-oriented programming paradigms.&lt;/li&gt;
&lt;li&gt;The Standard Template Library (STL) provides a collection of template classes and functions for common data structures and algorithms.&lt;/li&gt;
&lt;li&gt;Error handling in C++ is primarily done using exceptions.&lt;/li&gt;
&lt;li&gt;Advanced topics in C++ include pointers, memory management, templates, lambda expressions, and multithreading.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Resources for further learning
&lt;/h3&gt;

&lt;p&gt;To continue learning and expanding your C++ knowledge, consider the following resources:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;C++ reference websites, such as &lt;a href="https://www.cplusplus.com/" rel="noopener noreferrer"&gt;cplusplus.com&lt;/a&gt; and &lt;a href="https://en.cppreference.com/" rel="noopener noreferrer"&gt;cppreference.com&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Online programming courses and tutorials, such as &lt;a href="https://www.learncpp.com/" rel="noopener noreferrer"&gt;Learn C++&lt;/a&gt; and &lt;a href="https://www.udacity.com/course/c-for-programmers--ud210" rel="noopener noreferrer"&gt;C++ for Programmers&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Books on C++, such as "C++ Primer" by Stanley B. Lippman, Josée Lajoie, and Barbara E. Moo, and "Effective C++" by Scott Meyers.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Next steps in your C++ journey
&lt;/h3&gt;

&lt;p&gt;Now that you have a solid foundation in C++, you can start exploring more advanced topics, such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Graphical user interface (GUI) programming with libraries like Qt or GTK.&lt;/li&gt;
&lt;li&gt;Game development with engines like &lt;a href="https://godot.community/category/8/godot-engine" rel="noopener noreferrer"&gt;Godot Engine&lt;/a&gt;, Unreal Engine or Unity (with C++ scripting).&lt;/li&gt;
&lt;li&gt;Networking and web development with libraries like Boost.Asio or Poco.&lt;/li&gt;
&lt;li&gt;Embedded systems and IoT programming with platforms like Arduino and Raspberry Pi.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Keep practicing and building projects, and you'll become a proficient C++ programmer in no time!&lt;/p&gt;

</description>
      <category>cpp</category>
      <category>programming</category>
      <category>tutorial</category>
      <category>beginners</category>
    </item>
    <item>
      <title>GodotCon 2023</title>
      <dc:creator>Godot</dc:creator>
      <pubDate>Sun, 03 Sep 2023 21:35:04 +0000</pubDate>
      <link>https://dev.to/godot/godotcon-2023-jl</link>
      <guid>https://dev.to/godot/godotcon-2023-jl</guid>
      <description>&lt;h2&gt;
  
  
  Announcing GodotCon 2023: A Two-Day Event in Munich, Germany
&lt;/h2&gt;

&lt;p&gt;Get ready for an exciting two-day event, as GodotCon 2023 is set to take place in Munich, Germany on November 4th and 5th. The event will be packed with talks, Godot games, workshops, and opportunities to network with fellow Godot contributors. Whether you're a beginner or an experienced Godot user, there's something for everyone at this conference.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwj90m9frx1e9d3i1soh5.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwj90m9frx1e9d3i1soh5.webp" alt="GodotCon 2023" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Event&lt;/strong&gt;: GodotCon 2023&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;When&lt;/strong&gt;: November 4th and 5th, 2023.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Location&lt;/strong&gt;: &lt;a href="https://www.openstreetmap.org/way/428992680" rel="noopener noreferrer"&gt;Walter-Gropius-Str. 5, 80807 München, Germany&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;More Info&lt;/strong&gt;: 
&lt;a href="https://godotengine.org/article/godotcon-2023/" rel="noopener noreferrer"&gt;Join us at the Godot Conference 2023!&lt;/a&gt;
&lt;a href="https://godotengine.org/article/godotcon-2023-call-participation/" rel="noopener noreferrer"&gt;Godot Conference 2023: Call for Participations&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Call for Proposals: Share Your Ideas
&lt;/h2&gt;

&lt;p&gt;The organizers are eager to hear from the Godot community and are soon launching a Call for Proposals. This is your chance to propose a talk, workshop, or any other activity you think would be a great addition to the event. As the largest Godot event to date, the organizers want to ensure that everyone can participate in some way.&lt;/p&gt;

&lt;p&gt;Can't attend the event in person? Don't worry! The organizers plan to record the talks and workshops and make them available online. They'll also try to stream the event live, but they can't make any promises yet.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Venue: Microsoft Germany
&lt;/h2&gt;

&lt;p&gt;A dedicated team of Munich locals has been working hard to bring this event to life. They have secured a fantastic venue: Microsoft Germany. Located at Walter-Gropius-Str. 5, 80807 München, Germany, Microsoft's generous offer of their space allows GodotCon 2023 to become a reality.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tickets: Limited Availability
&lt;/h2&gt;

&lt;p&gt;Tickets for the event will be available soon, but keep in mind that they'll be limited. To stay informed about the ticket sale and receive any future communication regarding the conference, make sure to subscribe to the event's mailing list.&lt;/p&gt;

&lt;h2&gt;
  
  
  Event Highlights
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Call for Speakers &amp;amp; Workshops
&lt;/h3&gt;

&lt;p&gt;The organizers are looking for a diverse range of presentations and are inviting interested parties to propose talks or workshops. If you have a project or experience that would be of interest to Godot users, submit your proposal through the dedicated platform.&lt;/p&gt;

&lt;p&gt;There will be two tracks available:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Main track&lt;/li&gt;
&lt;li&gt;Workshops&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Please note that due to the number of proposals and available slots, some proposals may be rejected. If your proposal isn't accepted, don't feel discouraged—you can always try again next year.&lt;/p&gt;

&lt;h4&gt;
  
  
  Main Track
&lt;/h4&gt;

&lt;p&gt;The main track is open to talks on various topics. Presentations can be directly related to Godot or relevant to game or engine developers. The main track will run for the entire duration of the event, and talks can be either 30 or 60 minutes long (including 5-10 minutes for Q&amp;amp;A). If you require a different duration, you can specify your needs in your proposal.&lt;/p&gt;

&lt;p&gt;Some examples from last year's online GodotCon event include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;WebXR in Godot&lt;/li&gt;
&lt;li&gt;(Almost) A Year of Fam Jams&lt;/li&gt;
&lt;li&gt;Teaching Godot Engine: Learning Experience Design&lt;/li&gt;
&lt;li&gt;Wwise Godot Integration: integrating audio middleware into Godot&lt;/li&gt;
&lt;li&gt;The Garden Path&lt;/li&gt;
&lt;li&gt;The new rendering of Godot 4.0&lt;/li&gt;
&lt;li&gt;Extending the 2D Renderer: Adding 3D-Like Shadowing&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Workshops
&lt;/h4&gt;

&lt;p&gt;This year, there will be a dedicated room for workshops on both mornings of the event. Depending on the duration, two to four workshop slots will be available. Ideally, workshops should last between one and two hours. However, if your proposal requires more time, please indicate the required duration and explain why.&lt;/p&gt;

&lt;h2&gt;
  
  
  Call for Volunteers
&lt;/h2&gt;

&lt;p&gt;An event like GodotCon 2023 can't happen without a dedicated team of volunteers. The organizers are looking for individuals to help with various tasks during the event, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Steward Lead&lt;/li&gt;
&lt;li&gt;Stewards/General Volunteers&lt;/li&gt;
&lt;li&gt;Hosts (for speakers/sponsors)&lt;/li&gt;
&lt;li&gt;IT Lead&lt;/li&gt;
&lt;li&gt;IT Technicians&lt;/li&gt;
&lt;li&gt;Streaming Lead&lt;/li&gt;
&lt;li&gt;Streaming Operators &amp;amp; Moderators&lt;/li&gt;
&lt;li&gt;Ticketing &amp;amp; Accreditation Lead&lt;/li&gt;
&lt;li&gt;Ticketing &amp;amp; Accreditation&lt;/li&gt;
&lt;li&gt;Meet 2 Match Host&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you're interested in volunteering, send an email to &lt;a href="//mailto:godotcon@proton.me"&gt;godotcon@proton.me&lt;/a&gt; or join the &lt;a href="https://discord.gg/Qrj28UMQPj" rel="noopener noreferrer"&gt;GodotCon 2023 Discord server&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sponsorship Opportunities
&lt;/h2&gt;

&lt;p&gt;Sponsors are essential for making an event like GodotCon 2023 possible. The organizers are looking for sponsors to help cover costs related to the venue, security, catering, documentation, swag, speaker support, and more. Sponsoring the event offers a unique marketing opportunity with relatively low investment.&lt;/p&gt;

&lt;p&gt;If you're interested in sponsoring GodotCon 2023, send an email to &lt;a href="//mailto:contact@godotengine.org"&gt;contact@godotengine.org&lt;/a&gt; and provide details on how or what you'd like to sponsor. For more information, visit the &lt;a href="https://galvanized-slope-59b.notion.site/Public-GodotCon-Sponsorship-Page-acd1185de6594982943682caf4840d67" rel="noopener noreferrer"&gt;Sponsorship Page&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;A special thank you goes out to the current sponsors, Microsoft and DU&amp;amp;I, for their invaluable support.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnbwg12k116uaxoffs6zp.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnbwg12k116uaxoffs6zp.webp" alt="GodotCon 2023 Needs You" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Mark Your Calendars: GodotCon 2023 Awaits
&lt;/h2&gt;

&lt;p&gt;With an incredible lineup of talks, workshops, and networking opportunities, GodotCon 2023 is an event you won't want to miss. Mark your calendars for November 4th and 5th, and get ready for an unforgettable experience in Munich, Germany. See you there!&lt;/p&gt;

</description>
      <category>godotcon</category>
      <category>godot</category>
      <category>gamedev</category>
      <category>news</category>
    </item>
    <item>
      <title>Using Progression Systems to Keep Players Engaged</title>
      <dc:creator>Godot</dc:creator>
      <pubDate>Mon, 28 Aug 2023 09:55:52 +0000</pubDate>
      <link>https://dev.to/godot/using-progression-systems-to-keep-players-engaged-3k7n</link>
      <guid>https://dev.to/godot/using-progression-systems-to-keep-players-engaged-3k7n</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Progression systems are a crucial aspect of game design, playing a significant role in maintaining player engagement and ensuring a fulfilling gaming experience. In this post, we'll explore the different types of progression systems, their importance, and how they can be effectively implemented in various game genres.&lt;/p&gt;

&lt;h3&gt;
  
  
  Definition of progression systems
&lt;/h3&gt;

&lt;p&gt;Progression systems are mechanisms within games that allow players to advance, improve, and unlock new abilities, items, or content. These systems are designed to provide a sense of achievement and reward as players invest time and effort into the game.&lt;/p&gt;

&lt;h3&gt;
  
  
  Importance of player engagement
&lt;/h3&gt;

&lt;p&gt;Player engagement is essential for the success of a game. An engaged player is more likely to continue playing, recommend the game to others, and potentially spend money on in-game purchases. Progression systems contribute to engagement by providing players with a sense of purpose and a clear path for improvement and growth.&lt;/p&gt;

&lt;h3&gt;
  
  
  Role of progression systems in maintaining engagement
&lt;/h3&gt;

&lt;p&gt;Progression systems help maintain player engagement by:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Encouraging players to invest time and effort into the game.&lt;/li&gt;
&lt;li&gt;Providing a sense of accomplishment and reward.&lt;/li&gt;
&lt;li&gt;Offering meaningful choices and customization.&lt;/li&gt;
&lt;li&gt;Integrating with gameplay to create a cohesive experience.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Types of progression systems
&lt;/h2&gt;

&lt;p&gt;There are several types of progression systems commonly used in games, including:&lt;/p&gt;

&lt;h3&gt;
  
  
  Experience Points (XP) and leveling
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Players earn XP through completing tasks, defeating enemies, or discovering new areas.&lt;/li&gt;
&lt;li&gt;Accumulated XP contributes to leveling up, unlocking new abilities or stat increases.&lt;/li&gt;
&lt;li&gt;Example GDScript code snippet for increasing XP:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;gain_experience&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;xp&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;amount&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;xp&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="n"&gt;next_level_xp&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;level_up&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Skill trees and abilities
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Players can unlock and upgrade various skills or abilities, often branching into different specialties.&lt;/li&gt;
&lt;li&gt;Skill trees provide customization and meaningful choices for players.&lt;/li&gt;
&lt;li&gt;Example GDScript code snippet for unlocking a skill:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;unlock_skill&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;skill_name&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;skill_points&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="n"&gt;skill_cost&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;skill_name&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt;
        &lt;span class="n"&gt;skill_points&lt;/span&gt; &lt;span class="o"&gt;-=&lt;/span&gt; &lt;span class="n"&gt;skill_cost&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;skill_name&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="n"&gt;unlocked_skills&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;skill_name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Gear and equipment upgrades
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Players can find, purchase, or craft new gear and equipment to improve their character's stats.&lt;/li&gt;
&lt;li&gt;Upgrading gear encourages exploration, resource gathering, and in-game economy engagement.&lt;/li&gt;
&lt;li&gt;Example GDScript code snippet for equipping an item:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;equip_item&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;type&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;equipment_slots&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;unequip_item&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;equipment_slots&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;type&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
        &lt;span class="n"&gt;equipment_slots&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;type&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt;
        &lt;span class="n"&gt;apply_item_stats&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  In-game currency and economy
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Players earn in-game currency through various activities, such as completing quests or selling items.&lt;/li&gt;
&lt;li&gt;Currency can be used to purchase new gear, abilities, or other in-game content.&lt;/li&gt;
&lt;li&gt;Example GDScript code snippet for adding currency:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;add_currency&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;currency&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;amount&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Achievements and milestones
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Players can earn achievements or reach milestones by accomplishing specific tasks or goals.&lt;/li&gt;
&lt;li&gt;Achievements provide additional incentives for players to explore and challenge themselves.&lt;/li&gt;
&lt;li&gt;Example GDScript code snippet for unlocking an achievement:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;unlock_achievement&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;achievement_name&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;achievements&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;has&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;achievement_name&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;achievements&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;achievement_name&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Designing effective progression systems
&lt;/h2&gt;

&lt;p&gt;To design an effective progression system, consider the following aspects:&lt;/p&gt;

&lt;h3&gt;
  
  
  Balancing challenge and reward
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Ensure that the difficulty of challenges scales appropriately with the rewards provided.&lt;/li&gt;
&lt;li&gt;Avoid making progression too easy or too difficult to maintain engagement. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In order to create an engaging and satisfying progression system, it is crucial to strike a balance between the level of challenge and the rewards offered to the players. This can be achieved by ensuring that the difficulty of challenges scales appropriately with the rewards provided. As players progress through the game, they should encounter increasingly difficult tasks that test their skills and abilities, while simultaneously being rewarded with more valuable and meaningful incentives.&lt;/p&gt;

&lt;p&gt;To avoid making the progression system too easy or too difficult, it is important to carefully analyze the player's skill level and adjust the challenges accordingly. This will help maintain player engagement and prevent them from losing interest due to a lack of challenge or becoming frustrated by insurmountable obstacles.&lt;/p&gt;

&lt;h3&gt;
  
  
  Ensuring a sense of accomplishment
&lt;/h3&gt;

&lt;p&gt;In order to create a highly effective progression system, it is crucial to take into account several key aspects that contribute to a satisfying and engaging player experience:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Striking a balance between challenge and reward&lt;/strong&gt;: To maintain player interest and motivation, it is essential to find the right balance between the level of difficulty presented in challenges and the rewards offered for overcoming them. This balance ensures that players feel adequately challenged without becoming overwhelmed or frustrated.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Scaling difficulty and rewards proportionately&lt;/strong&gt;: As players progress through the game, the difficulty of challenges should increase in tandem with the rewards provided. This ensures that players continue to feel motivated to tackle more difficult tasks, while also feeling that their efforts are being justly rewarded.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Avoiding extremes in progression&lt;/strong&gt;: To keep players engaged and prevent them from losing interest, it is important to avoid making the progression system either too easy or too difficult. A well-designed progression system should offer a steady increase in challenge that keeps players invested in the game without causing undue frustration.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Fostering a sense of accomplishment&lt;/strong&gt;: An effective progression system should instill a strong sense of achievement in players as they overcome challenges and reach new milestones. This can be achieved by providing players with tangible rewards and recognition for their efforts, such as in-game items, abilities, or other bonuses that enhance their gameplay experience.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Utilizing visual and audio cues to celebrate achievements&lt;/strong&gt;: To further emphasize the sense of accomplishment, incorporate visual and audio cues that celebrate players' achievements and milestones. These cues can include animations, sound effects, or other in-game elements that signal to the player that they have reached a significant point in their progression. By doing so, you create a more immersive and rewarding experience that encourages players to continue striving for success.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Providing meaningful choices
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Offer players multiple paths for progression, allowing them to customize their experience.&lt;/li&gt;
&lt;li&gt;Ensure that choices have distinct and noticeable impacts on gameplay.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Offer players a variety of progression paths, enabling them to tailor their gaming experience according to their preferences and playstyles. By presenting diverse options, players can explore different strategies and approaches, making their journey through the game more engaging and personalized.&lt;/p&gt;

&lt;p&gt;To maintain player interest and investment, it is crucial to ensure that the choices they make have distinct and significant consequences on gameplay. This can be achieved by designing each choice to lead to unique outcomes, challenges, and rewards, ultimately affecting the overall game narrative and environment. By doing so, players will feel that their decisions matter, fostering a deeper connection to the game and enhancing their sense of agency and immersion.&lt;/p&gt;

&lt;h3&gt;
  
  
  Integrating progression systems with gameplay
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Progression systems should complement and enhance the core gameplay loop, not detract from it.&lt;/li&gt;
&lt;li&gt;Consider how progression elements can be woven into the game world, narrative, and mechanics.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In order to create a truly immersive gaming experience, it is essential that progression systems are carefully designed to complement and augment the core gameplay loop, rather than detracting from it or feeling like an afterthought. By seamlessly integrating progression elements into the game world, narrative, and mechanics, developers can create a more engaging and rewarding experience for players.&lt;/p&gt;

&lt;p&gt;To achieve this, developers should consider how progression systems can be intricately woven into the game world, making them feel like a natural part of the environment. This can be accomplished by incorporating visual cues, environmental storytelling, and world-building elements that reflect the player's progress and growth. For example, as players advance through the game, they may notice changes in the landscape, the behavior of NPCs, or the availability of new areas to explore, all of which serve to reinforce their sense of progression.&lt;/p&gt;

&lt;p&gt;Furthermore, it is important to ensure that progression systems are deeply intertwined with the game's narrative. This can be achieved by having the player's choices and actions directly impact the story, leading to unique outcomes, challenges, and rewards. By doing so, players will feel that their decisions genuinely matter, fostering a deeper connection to the game and enhancing their sense of agency and immersion. This can be achieved through branching storylines, dynamic dialogue, and a variety of narrative consequences that reflect the player's progress and choices.&lt;/p&gt;

&lt;p&gt;Lastly, developers should strive to integrate progression systems with the game's mechanics in a way that feels organic and rewarding. This can be done by designing progression systems that enhance the player's abilities, unlock new gameplay options, and encourage experimentation with different strategies and playstyles. For example, as players progress, they may gain access to new skills, equipment, or abilities that allow them to overcome previously insurmountable challenges or explore new aspects of the game world. By doing so, players will feel a sense of accomplishment and satisfaction as they witness their growth and mastery over the game's mechanics.&lt;/p&gt;

&lt;p&gt;In summary, by thoughtfully integrating progression systems with the game world, narrative, and mechanics, developers can create a more engaging, immersive, and satisfying gaming experience for players. By ensuring that progression feels like a natural and meaningful aspect of the game, players will be more likely to form a deep connection to the game and feel a greater sense of agency and immersion.&lt;/p&gt;

&lt;h3&gt;
  
  
  Encouraging exploration and experimentation
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Reward players for discovering hidden secrets or trying new strategies.&lt;/li&gt;
&lt;li&gt;Create a sense of mystery and curiosity to drive exploration.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Incorporating progression systems seamlessly with gameplay dynamics&lt;/strong&gt;&lt;br&gt;
To create a truly engaging gaming experience, progression systems must be designed to complement and amplify the core gameplay loop, rather than detracting from it or feeling like an afterthought. This can be achieved by carefully considering how various progression elements can be intricately woven into the game world, its narrative, and the mechanics that govern player interactions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fostering exploration and experimentation through incentives&lt;/strong&gt;&lt;br&gt;
One effective way to encourage players to explore the game world and experiment with different strategies is by offering them tangible rewards for uncovering hidden secrets or successfully employing novel tactics. These incentives can take the form of in-game currency, unique items, or even access to new areas or abilities that further enrich the gaming experience.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cultivating a sense of mystery and curiosity to propel exploration&lt;/strong&gt;&lt;br&gt;
To truly captivate players and motivate them to delve deeper into the game world, it's essential to create an atmosphere of mystery and curiosity. This can be achieved by incorporating intriguing storylines, enigmatic characters, and cryptic clues that hint at the existence of undiscovered secrets. By fostering a sense of wonder and intrigue, players will be more inclined to venture off the beaten path and immerse themselves in the rich tapestry of the game world.&lt;/p&gt;

&lt;h2&gt;
  
  
  Implementing progression systems in different game genres
&lt;/h2&gt;

&lt;p&gt;Progression systems can be tailored to fit various game genres, such as:&lt;/p&gt;

&lt;h3&gt;
  
  
  Role-playing games (RPGs)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Focus on character development, including leveling, skill trees, and gear upgrades.&lt;/li&gt;
&lt;li&gt;Incorporate story-driven progression elements, such as unlocking new areas or abilities through narrative events.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Action-adventure games
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Emphasize exploration and discovery, with progression elements tied to uncovering new locations or abilities.&lt;/li&gt;
&lt;li&gt;Balance combat and puzzle-solving challenges with appropriate rewards.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Puzzle games
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Use progression systems to introduce new mechanics or increase difficulty over time.&lt;/li&gt;
&lt;li&gt;Reward players with new levels or modes upon completing certain milestones.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Strategy games
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Implement progression systems that allow players to unlock new units, buildings, or technologies.&lt;/li&gt;
&lt;li&gt;Balance short-term and long-term progression goals to maintain player interest.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Sports and racing games
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Progression systems can include unlocking new vehicles, tracks, or customization options.&lt;/li&gt;
&lt;li&gt;Use skill-based progression elements, such as improving player stats or abilities.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Player feedback and analytics
&lt;/h2&gt;

&lt;p&gt;Gathering player feedback and analyzing data can help refine and improve progression systems:&lt;/p&gt;

&lt;h3&gt;
  
  
  Gathering player feedback
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Use surveys, forums, or social media to collect player opinions on progression systems.&lt;/li&gt;
&lt;li&gt;Pay attention to common issues or suggestions for improvement.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Analyzing player behavior and data
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Monitor player behavior, such as time spent playing, progression speed, and areas of difficulty.&lt;/li&gt;
&lt;li&gt;Use data to identify areas where progression systems may need adjustment.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Adjusting progression systems based on feedback and analytics
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Make adjustments to progression systems based on player feedback and data analysis.&lt;/li&gt;
&lt;li&gt;Iterate on design and implementation to continuously improve the player experience.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Well-designed progression systems are essential for maintaining player engagement and creating a satisfying gaming experience. By tailoring progression systems to specific game genres and continuously refining and improving them based on player feedback and analytics, developers can ensure that their games remain engaging and enjoyable for players.&lt;/p&gt;

</description>
      <category>gamedev</category>
      <category>beginners</category>
      <category>tutorial</category>
      <category>gdscript</category>
    </item>
    <item>
      <title>Godot at Gamescom 2023</title>
      <dc:creator>Godot</dc:creator>
      <pubDate>Thu, 17 Aug 2023 19:09:08 +0000</pubDate>
      <link>https://dev.to/godot/godot-at-gamescom-2023-4ppg</link>
      <guid>https://dev.to/godot/godot-at-gamescom-2023-4ppg</guid>
      <description>&lt;p&gt;Just want to make a quick shoutout that Godot will be having their first booth at Gamescom 2023, thanks to Ramatak &amp;amp; W4Games donations for the booth.&lt;/p&gt;

&lt;p&gt;&lt;iframe class="tweet-embed" id="tweet-1692215009974104221-424" src="https://platform.twitter.com/embed/Tweet.html?id=1692215009974104221"&gt;
&lt;/iframe&gt;

  // Detect dark theme
  var iframe = document.getElementById('tweet-1692215009974104221-424');
  if (document.body.className.includes('dark-theme')) {
    iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=1692215009974104221&amp;amp;theme=dark"
  }



&lt;/p&gt;

&lt;h3&gt;
  
  
  Where
&lt;/h3&gt;

&lt;p&gt;Koelnmesse, Messepl. 1, 50679 Köln, Germany (&lt;a href="https://www.openstreetmap.org/?mlat=50.94590&amp;amp;mlon=6.98034map%3D16%2F50.9441%2F6.9798#map=16/50.9455/6.9805&amp;amp;layers=N" rel="noopener noreferrer"&gt;map&lt;/a&gt;)&lt;/p&gt;

&lt;h3&gt;
  
  
  When?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;August 23rd, 2023. Wednesday 13:00 - 19:00&lt;/li&gt;
&lt;li&gt;August 24th, 2023. Thursday 10:00 - 20:00&lt;/li&gt;
&lt;li&gt;August 25th, 2023. Friday 10:00 - 20:00&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Which Location?
&lt;/h3&gt;

&lt;p&gt;Godot booth in the Business Area, Hall 2.2, Stand C-042. Check the map below: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffyb7hee8gdrgodb4gkx4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffyb7hee8gdrgodb4gkx4.png" alt="godot gamescom 2023" width="800" height="546"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;For those who don't know about Gamescom, it is a trade fair for video games held annually at the Koelnmesse in Cologne, North Rhine-Westphalia. It is the world’s largest gaming event (measured by exhibition space and number of visitors), with 370,000 visitors and 1037 exhibitors from 56 countries attending the show in 2018.&lt;/p&gt;

&lt;p&gt;For more details, please check the official announcement &lt;a href="https://godotengine.org/article/godot-at-gamescom-2023/" rel="noopener noreferrer"&gt;page&lt;/a&gt;. &lt;/p&gt;

</description>
      <category>godot</category>
      <category>gamedev</category>
      <category>gamescom</category>
      <category>beginners</category>
    </item>
    <item>
      <title>GDScript Code Ordering</title>
      <dc:creator>Godot</dc:creator>
      <pubDate>Wed, 16 Aug 2023 08:07:37 +0000</pubDate>
      <link>https://dev.to/godot/gdscript-code-ordering-5d9f</link>
      <guid>https://dev.to/godot/gdscript-code-ordering-5d9f</guid>
      <description>&lt;p&gt;&lt;strong&gt;GDScript Code Ordering: Best Practices for Arranging Your Code Elements&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When it comes to writing clean and organized GDScript code, the ordering of code elements plays an essential role in enhancing readability and maintainability. In this post, we'll explore best practices for ordering different code elements within your GDScript files.&lt;/p&gt;




&lt;h3&gt;
  
  
  Introduction to Code Ordering
&lt;/h3&gt;

&lt;p&gt;Code ordering refers to the systematic arrangement of different code elements within your GDScript files. Having a consistent and logical order makes it easier for developers to quickly grasp the structure of your code and find specific elements. While there is no strict rule for code ordering, following some common conventions will lead to well-organized and easily maintainable code.&lt;/p&gt;




&lt;h3&gt;
  
  
  Recommended Code Element Ordering
&lt;/h3&gt;

&lt;p&gt;Below, we present a recommended order for organizing code elements within your GDScript files. Remember that these conventions are guidelines, and you can adjust them to suit your project's needs and team preferences.&lt;/p&gt;

&lt;h4&gt;
  
  
  Declaration
&lt;/h4&gt;

&lt;p&gt;Begin by listing all necessary class declaration statements at the top of your GDScript file. These statements help you access external classes and modules within your script.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="k"&gt;class_name&lt;/span&gt; &lt;span class="n"&gt;Player&lt;/span&gt; &lt;span class="k"&gt;extends&lt;/span&gt; &lt;span class="n"&gt;CharacterBody2D&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If your script is a tool (ie running in the Editor), make sure you put the annotation at the very top of the code&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="err"&gt;@&lt;/span&gt;&lt;span class="k"&gt;tool&lt;/span&gt;
&lt;span class="k"&gt;class_name&lt;/span&gt; &lt;span class="n"&gt;Player&lt;/span&gt; &lt;span class="k"&gt;extends&lt;/span&gt; &lt;span class="n"&gt;CharacterBody2D&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You might need to save and reopen the scenes/script for it to take effect.&lt;/p&gt;

&lt;h4&gt;
  
  
  Signals
&lt;/h4&gt;

&lt;p&gt;After that, define the signals that your script emits. Signals are custom events that allow communication between nodes, therefore it is beneficial to have it right up above.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="k"&gt;class_name&lt;/span&gt; &lt;span class="n"&gt;Player&lt;/span&gt; &lt;span class="k"&gt;extends&lt;/span&gt; &lt;span class="n"&gt;CharacterBody2D&lt;/span&gt;

&lt;span class="k"&gt;signal&lt;/span&gt; &lt;span class="n"&gt;health_depleted&lt;/span&gt;
&lt;span class="k"&gt;signal&lt;/span&gt; &lt;span class="n"&gt;player_moved&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;Vector2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Enums
&lt;/h4&gt;

&lt;p&gt;If your script uses enums, you can do so after the signals. Enums are user-defined sets of named constants and are often used to represent different states or options.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="k"&gt;enum&lt;/span&gt; &lt;span class="n"&gt;GameState&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;MENU&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;PLAY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;PAUSE&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;enum&lt;/span&gt; &lt;span class="n"&gt;Direction&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;UP&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;DOWN&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;LEFT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;RIGHT&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Constants
&lt;/h4&gt;

&lt;p&gt;Next, define any constants that your script requires. Constants are values that do not change during runtime and are better suited for this early section of your script.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="n"&gt;MAX_SCORE&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;
&lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="n"&gt;PLAYER_SPEED&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;200.0&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Class Variables
&lt;/h4&gt;

&lt;p&gt;Now, organize your class variables. Group them into different subsections based on their purposes.&lt;/p&gt;

&lt;h5&gt;
  
  
  Export Variables
&lt;/h5&gt;

&lt;p&gt;Export variables come first, as they allow you to expose certain variables in the Inspector. This makes them easily accessible and configurable from the Godot editor.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Good export variables ordering example&lt;/span&gt;
&lt;span class="k"&gt;class_name&lt;/span&gt; &lt;span class="n"&gt;Player&lt;/span&gt; &lt;span class="k"&gt;extends&lt;/span&gt; &lt;span class="n"&gt;CharacterBody2D&lt;/span&gt;
&lt;span class="o"&gt;...&lt;/span&gt;
&lt;span class="o"&gt;...&lt;/span&gt;
&lt;span class="err"&gt;@&lt;/span&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;player_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Player"&lt;/span&gt;
&lt;span class="err"&gt;@&lt;/span&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;player_health&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Regular Variables
&lt;/h5&gt;

&lt;p&gt;Then, list your regular class variables, public and private. You can mark a variable as a private by prefixing them with _ underscore. Doing so will hide your variable from showing inside the built in IDE Documentation.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="k"&gt;class_name&lt;/span&gt; &lt;span class="n"&gt;Player&lt;/span&gt; &lt;span class="k"&gt;extends&lt;/span&gt; &lt;span class="n"&gt;CharacterBody2D&lt;/span&gt;

&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;score&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;_is_gameover&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;bool&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;false&lt;/span&gt; &lt;span class="c1"&gt;#private, will not appear on docs&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Onready Variables
&lt;/h5&gt;

&lt;p&gt;Onready variables come last after every other variables. They represent references to nodes that you need early on right after initialization.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="k"&gt;class_name&lt;/span&gt; &lt;span class="n"&gt;Player&lt;/span&gt; &lt;span class="k"&gt;extends&lt;/span&gt; &lt;span class="n"&gt;CharacterBody2D&lt;/span&gt;
&lt;span class="o"&gt;...&lt;/span&gt;
&lt;span class="o"&gt;...&lt;/span&gt;
&lt;span class="err"&gt;@&lt;/span&gt;&lt;span class="k"&gt;onready&lt;/span&gt; &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;player_sprite&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Sprite&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;$&lt;/span&gt;&lt;span class="n"&gt;PlayerSprite&lt;/span&gt;
&lt;span class="err"&gt;@&lt;/span&gt;&lt;span class="k"&gt;onready&lt;/span&gt; &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;enemy_spawner&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;EnemySpawner&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;$&lt;/span&gt;&lt;span class="n"&gt;EnemySpawner&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Constructor and Initialization
&lt;/h4&gt;

&lt;p&gt;After the class variables, you can include the constructor (also known as the &lt;code&gt;_init&lt;/code&gt; method) if you need to initialize any variables. Note that overriding the &lt;code&gt;_init&lt;/code&gt;, &lt;code&gt;_ready&lt;/code&gt;, &lt;code&gt;_enter_tree&lt;/code&gt; or other built-in virtual function is optional.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Good constructor and initialization ordering example&lt;/span&gt;
&lt;span class="k"&gt;class_name&lt;/span&gt; &lt;span class="n"&gt;Player&lt;/span&gt; &lt;span class="k"&gt;extends&lt;/span&gt; &lt;span class="n"&gt;CharacterBody2D&lt;/span&gt;

&lt;span class="c1"&gt;# Constructor&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;_init&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;void&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;player_additem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Item&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SWORD&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;player_additem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Item&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SHIELD&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;_enter_tree&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;void&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;parent_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;get_parent&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Parented to: "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;parent_name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;_ready&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;void&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;_sync_textures&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;_sync_animations&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Public Methods
&lt;/h4&gt;

&lt;p&gt;Finally, place your class public methods. Group them based on their purposes or relevance to specific aspects of your script.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Good class methods ordering example&lt;/span&gt;
&lt;span class="k"&gt;class_name&lt;/span&gt; &lt;span class="n"&gt;Player&lt;/span&gt; &lt;span class="k"&gt;extends&lt;/span&gt; &lt;span class="n"&gt;CharacterBody2D&lt;/span&gt;

&lt;span class="c1"&gt;# Initialization methods&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;_ready&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;void&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;pass&lt;/span&gt;

&lt;span class="c1"&gt;# Player movement related methods&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;move_player&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;void&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;pass&lt;/span&gt;

&lt;span class="c1"&gt;# Player combat related methods&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;damage_player&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;void&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;pass&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Private Methods
&lt;/h4&gt;

&lt;p&gt;Methods of your class can be marked as private by prefixing them with _ underscore. Private variables and private methods that are prefixed by _ will not appear when you open &lt;code&gt;Search Help (F1)&lt;/code&gt; of this particular class.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;_internal_check&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="c1"&gt;# _internal_check will not appear in IDE Help&lt;/span&gt;
    &lt;span class="k"&gt;pass&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Code Organization in Functions
&lt;/h3&gt;

&lt;p&gt;Within your class methods, aim for consistent code organization to maintain readability.&lt;/p&gt;

&lt;h4&gt;
  
  
  Arguments
&lt;/h4&gt;

&lt;p&gt;List function arguments in a logical order, with required arguments first and optional arguments last.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Good function arguments ordering example&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;move_player&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;direction&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;Vector2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;speed&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;200.0&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;pass&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Local Variables
&lt;/h4&gt;

&lt;p&gt;Declare local variables at the beginning of the function before using them.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Good local variables ordering example&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;calculate_score&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;score_value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;bonus_score&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;score_value&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;bonus_score&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Function Logic
&lt;/h4&gt;

&lt;p&gt;Organize the logic of your functions in a way that is clear and easy to follow. Consider using comments to explain complex sections. Best code is the one that doesn't require comments and innately self explanatory.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;is_game_over&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;bool&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;player_health&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;player_lives&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="bp"&gt;true&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="bp"&gt;false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Example
&lt;/h3&gt;

&lt;p&gt;Now with all that said and done, here is the final snippet to sum it all up. See it in action.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: The examples and conventions provided in this post are intended as guidelines. Feel free to tailor them to your specific needs and preferences. Consistency is key!&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="err"&gt;@&lt;/span&gt;&lt;span class="k"&gt;tool&lt;/span&gt;
&lt;span class="c1"&gt;## This is the Player class, representing the player character in the game.&lt;/span&gt;
&lt;span class="k"&gt;class_name&lt;/span&gt; &lt;span class="n"&gt;Player&lt;/span&gt; &lt;span class="k"&gt;extends&lt;/span&gt; &lt;span class="n"&gt;CharacterBody2D&lt;/span&gt;

&lt;span class="c1"&gt;# Signals&lt;/span&gt;
&lt;span class="k"&gt;signal&lt;/span&gt; &lt;span class="n"&gt;player_hit&lt;/span&gt;
&lt;span class="k"&gt;signal&lt;/span&gt; &lt;span class="n"&gt;player_jump&lt;/span&gt;

&lt;span class="c1"&gt;# Enums&lt;/span&gt;
&lt;span class="k"&gt;enum&lt;/span&gt; &lt;span class="n"&gt;PlayerState&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;IDLE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;RUNNING&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;JUMPING&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;FALLING&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;# Constants&lt;/span&gt;
&lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="n"&gt;MAX_HEALTH&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;
&lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="n"&gt;MAX_SPEED&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;150.0&lt;/span&gt;

&lt;span class="c1"&gt;# @export variables&lt;/span&gt;
&lt;span class="err"&gt;@&lt;/span&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;player_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Player"&lt;/span&gt;
&lt;span class="err"&gt;@&lt;/span&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;player_health&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;MAX_HEALTH&lt;/span&gt;

&lt;span class="c1"&gt;# Public variables&lt;/span&gt;
&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;player_state&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;PlayerState&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;PlayerState&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;IDLE&lt;/span&gt;

&lt;span class="c1"&gt;# Private variables&lt;/span&gt;
&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;_is_invincible&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;bool&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;false&lt;/span&gt;
&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;_jump_power&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;400.0&lt;/span&gt;

&lt;span class="c1"&gt;# @onready variables&lt;/span&gt;
&lt;span class="err"&gt;@&lt;/span&gt;&lt;span class="k"&gt;onready&lt;/span&gt; &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;player_sprite&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Sprite2D&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;$&lt;/span&gt;&lt;span class="n"&gt;Sprite2D&lt;/span&gt;
&lt;span class="err"&gt;@&lt;/span&gt;&lt;span class="k"&gt;onready&lt;/span&gt; &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;collision_shape&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;CollisionShape2D&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;$&lt;/span&gt;&lt;span class="n"&gt;CollisionShape2D&lt;/span&gt;

&lt;span class="c1"&gt;# Optional built-in virtual _init method&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;_init&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
        &lt;span class="n"&gt;player_health&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;MAX_HEALTH&lt;/span&gt;
        &lt;span class="n"&gt;_is_invincible&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;false&lt;/span&gt;

&lt;span class="c1"&gt;# Optional built-in virtual _enter_tree() method&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;_enter_tree&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
        &lt;span class="c1"&gt;# Code here will be executed when the node enters the scene tree.&lt;/span&gt;
        &lt;span class="k"&gt;pass&lt;/span&gt;

&lt;span class="c1"&gt;# Built-in virtual _ready method&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;_ready&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
        &lt;span class="c1"&gt;# Code here will be executed once when the node is added to the scene and ready.&lt;/span&gt;
        &lt;span class="k"&gt;pass&lt;/span&gt;

&lt;span class="c1"&gt;# Remaining built-in virtual methods&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;_process&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;delta&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;float&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="c1"&gt;# Code here will be executed every frame (if the node is added to the scene and ready).&lt;/span&gt;
        &lt;span class="k"&gt;pass&lt;/span&gt;

&lt;span class="c1"&gt;# Public methods&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;take_damage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;damage_amount&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;_is_invincible&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;player_health&lt;/span&gt; &lt;span class="o"&gt;-=&lt;/span&gt; &lt;span class="n"&gt;damage_amount&lt;/span&gt;
                &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;player_health&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                        &lt;span class="n"&gt;emit_signal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"player_hit"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;jump&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;is_on_floor&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
                &lt;span class="n"&gt;player_state&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;PlayerState&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;JUMPING&lt;/span&gt;
                &lt;span class="n"&gt;apply_impulse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;Vector2&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;UP&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;_jump_power&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="n"&gt;emit_signal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"player_jump"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Private methods&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;_on_invincibility_timer_timeout&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
        &lt;span class="n"&gt;_is_invincible&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;false&lt;/span&gt;

&lt;span class="c1"&gt;# Subclasses&lt;/span&gt;
&lt;span class="c1"&gt;# Add any subclasses here, if applicable.&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Summary
&lt;/h3&gt;

&lt;p&gt;Following an organized code ordering is crucial for creating clean, maintainable, and readable GDScript code. By adopting a consistent approach to arranging your code elements, you can improve collaboration within your development team and make it easier for other developers to understand and contribute to your projects.&lt;/p&gt;

&lt;p&gt;Remember that the conventions provided in this post are recommendations, not strict rules. Feel free to adapt them to your project's needs and your team's preferences. The key is to maintain consistency throughout your codebase, making it easier for everyone to work together efficiently.&lt;/p&gt;

&lt;p&gt;Happy coding, and may your GDScript projects shine with well-organized and easily understandable code! 🚀🎮&lt;/p&gt;

</description>
      <category>gdscript</category>
      <category>godotengine</category>
      <category>godot</category>
      <category>gamedev</category>
    </item>
    <item>
      <title>GDScript Coding Conventions</title>
      <dc:creator>Godot</dc:creator>
      <pubDate>Mon, 14 Aug 2023 10:10:27 +0000</pubDate>
      <link>https://dev.to/godot/gdscript-coding-conventions-51nd</link>
      <guid>https://dev.to/godot/gdscript-coding-conventions-51nd</guid>
      <description>&lt;p&gt;Hello fellow DEV community!&lt;/p&gt;

&lt;p&gt;Today, I want to dive into an essential topic that often gets overlooked but plays a crucial role in creating clean, readable, and maintainable GDScript code: coding conventions. Consistent coding conventions not only make your code more organized but also contribute to the overall productivity and collaboration within your development team. So, let's explore some best practices for writing GDScript code, including naming conventions for assets, scenes, and nodes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyviqu0twzj3fa5i2srm8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyviqu0twzj3fa5i2srm8.png" alt="look at them codes" width="800" height="390"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Introduction to GDScript Coding Conventions
&lt;/h3&gt;

&lt;p&gt;Coding conventions are a set of guidelines and rules that developers follow to maintain consistency in their codebase. They help create a standardized format, making it easier for developers to understand each other's code and contribute effectively. GDScript, as a flexible and Python-like scripting language, allows developers to write code in various ways. However, sticking to a common set of conventions enhances code quality and makes your projects more robust.&lt;/p&gt;

&lt;p&gt;In this post, we'll cover some general coding conventions and delve into naming conventions for variables, functions, classes, and more. Additionally, we'll explore how to apply these conventions to assets, scenes, and nodes in your Godot projects.&lt;/p&gt;

&lt;h3&gt;
  
  
  General Coding Conventions
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Indentation
&lt;/h4&gt;

&lt;p&gt;Consistent indentation is vital for code readability. GDScript generally uses tabs for indentation. Avoid using spaces, as different editors might interpret them differently.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Bad indentation example&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;calculate_score&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;score_value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;score_value&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;score_value&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;score_value&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Good indentation example (using tabs)&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;calculate_score&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;score_value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;score_value&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;score_value&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;score_value&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Line Length
&lt;/h4&gt;

&lt;p&gt;To enhance code readability, aim to keep your lines of code within a reasonable length. A common practice is to limit lines to around 80 characters. If a line becomes too long, consider breaking it into multiple lines or using parentheses for better formatting.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Good line length example&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;_ready&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Hello, Godot developers! Welcome to our community."&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Bad line length example&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;_ready&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Hello, Godot developers! Welcome to our community."&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Whitespace
&lt;/h4&gt;

&lt;p&gt;Use whitespace judiciously to separate different parts of your code and improve readability. Add spaces after commas, around operators, and between function arguments.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Good use of whitespace example&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;calculate_total_score&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;score1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;score2&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;score1&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;score2&lt;/span&gt;

&lt;span class="c1"&gt;# Bad use of whitespace example&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;calculate_total_score&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;score1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;score2&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;score1&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="n"&gt;score2&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Comments
&lt;/h4&gt;

&lt;p&gt;Add comments to explain your code and its purpose. Well-commented code helps other developers, including your future self, understand the logic and functionality of your code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Good use of comments example&lt;/span&gt;
&lt;span class="c1"&gt;# This function calculates the total score by adding two individual scores.&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;calc_total&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;s2&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;s1&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;s2&lt;/span&gt;

&lt;span class="c1"&gt;# Bad use of comments example&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;calc_total&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;s2&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;s1&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;s2&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Nevertheless, the best code is the code that doesn't require comments as it is innately self explanatory.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;calculate_total_score&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;score1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;score2&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;score1&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;score2&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Naming Conventions
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Variables and Constants
&lt;/h4&gt;

&lt;p&gt;Use descriptive names for variables and constants that indicate their purpose. Names should be in lowercase, with words separated by underscores.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Good variable naming example&lt;/span&gt;
&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;player_health&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;
&lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="n"&gt;MAX_ENEMIES&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;

&lt;span class="c1"&gt;# Bad variable naming example&lt;/span&gt;
&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;
&lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="nb"&gt;max&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Functions and Methods
&lt;/h4&gt;

&lt;p&gt;Function and method names should also be descriptive and use lowercase letters with underscores to separate words.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Good function naming example&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;calculate_score&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;score_value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;score_value&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;

&lt;span class="c1"&gt;# Bad function naming example&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;clc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;score&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;score&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Classes and Enums
&lt;/h4&gt;

&lt;p&gt;Use PascalCase for class and enum names. Class names should be nouns, while enum names should be singular nouns.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Good class and enum naming example&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Player&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;enum&lt;/span&gt; &lt;span class="n"&gt;Direction&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;UP&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;DOWN&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;LEFT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;RIGHT&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;# Bad class and enum naming example&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;playeR&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;enum&lt;/span&gt; &lt;span class="n"&gt;direction&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;UP&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;DOWN&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;LEFT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;RIGHT&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Naming Conventions for Assets and Scenes
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Assets
&lt;/h4&gt;

&lt;p&gt;When naming assets, camel_case, use lowercase letters and separate words with underscores. Be descriptive and use meaningful names that indicate the asset's purpose. The reason why we use all lowercase letters is that each platforms have different ways in treating uppercase and lowercase in file names.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Good asset naming example&lt;/span&gt;
&lt;span class="n"&gt;main_room&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tscn&lt;/span&gt;
&lt;span class="n"&gt;main_room&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;gd&lt;/span&gt;
&lt;span class="n"&gt;background_image&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;png&lt;/span&gt;
&lt;span class="n"&gt;enemy_sprite&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;png&lt;/span&gt;
&lt;span class="n"&gt;jump_sound&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;wav&lt;/span&gt;

&lt;span class="c1"&gt;# Bad asset naming example&lt;/span&gt;
&lt;span class="n"&gt;mainRoom&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tscn&lt;/span&gt;
&lt;span class="n"&gt;mainRoom&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;gd&lt;/span&gt;
&lt;span class="n"&gt;bg&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;png&lt;/span&gt;
&lt;span class="n"&gt;spr1&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;png&lt;/span&gt;
&lt;span class="n"&gt;sound1&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;wav&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Nodes
&lt;/h4&gt;

&lt;p&gt;Nodes in scenes should follow PascalCase conventions. Choose descriptive names that represent the node's functionality.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Good node naming example&lt;/span&gt;
&lt;span class="n"&gt;PlayerCharacter&lt;/span&gt;
&lt;span class="n"&gt;EnemySpawner&lt;/span&gt;
&lt;span class="n"&gt;ScoreLabel&lt;/span&gt;

&lt;span class="c1"&gt;# Bad node naming example&lt;/span&gt;
&lt;span class="n"&gt;Player&lt;/span&gt;
&lt;span class="n"&gt;Node2D&lt;/span&gt;
&lt;span class="n"&gt;Label&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Coding Style
&lt;/h3&gt;

&lt;p&gt;Consistency is key when it comes to coding style. Ensure that you and your team members follow the same conventions throughout your project. Adopting a consistent coding style improves readability and makes your code look professional.&lt;/p&gt;

&lt;p&gt;In addition to the conventions mentioned above, consider adopting the following practices:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Use Meaningful Names&lt;/strong&gt;: Always choose meaningful names for variables, functions, classes, and nodes. Avoid single-letter or vague names that might confuse other developers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Be Mindful of Abbreviations&lt;/strong&gt;: While abbreviations can save typing, be cautious with them. Avoid using obscure or ambiguous abbreviations that might not be immediately understandable.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Avoid Magic Numbers&lt;/strong&gt;: Instead of using literal values in your code, assign them to constants with descriptive names. This improves code readability and makes it easier to maintain.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Limit Function Length&lt;/strong&gt;: Aim to keep your functions short and focused. Long functions can become difficult to manage and understand.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Organize Code Logically&lt;/strong&gt;: Structure your code in a logical manner, breaking it into meaningful sections or using comments to group related code together.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;
  
  
  Code Reusability
&lt;/h3&gt;

&lt;p&gt;An essential benefit of following coding conventions is that it promotes code reusability. When your code is well-organized and follows consistent conventions, you can easily reuse functions, methods, and classes across different projects.&lt;/p&gt;

&lt;p&gt;By applying the same conventions to your assets, scenes, and nodes, you can also streamline your workflow when working with Godot Engine. Consistent naming and organization help you find and manage resources more efficiently, resulting in a smoother development process.&lt;/p&gt;

&lt;h3&gt;
  
  
  Summary
&lt;/h3&gt;

&lt;p&gt;Coding conventions are an invaluable tool for any Godot developer seeking to create clean, readable, and maintainable code. In this post, we explored some general coding conventions, including indentation, line length, whitespace, and commenting. We also discussed naming conventions for variables, functions, classes, enums, assets, scenes, and nodes.&lt;/p&gt;

&lt;p&gt;Adopting coding conventions in your projects enhances code quality, increases collaboration within your team, and facilitates code reuse. Consistent naming and organization make it easier for you and other developers to understand and contribute to the codebase effectively.&lt;/p&gt;

&lt;p&gt;Remember that while coding conventions offer a set of guidelines, they are not set in stone. You can adapt them to suit your team's preferences and requirements. What matters most is that you and your team members follow the same conventions consistently throughout your projects.&lt;/p&gt;

&lt;p&gt;Happy coding, and may your Godot projects thrive with clean and maintainable code! 🚀🎮&lt;/p&gt;

</description>
      <category>gdscript</category>
      <category>godotengine</category>
      <category>godot</category>
      <category>gamedev</category>
    </item>
  </channel>
</rss>
