Featured Streamer:

Basic Godot GDScript Syntax Cheat Sheet

Basic Godot GDScript Syntax Cheat Sheet

By Jolt (Pharahtato)

I am in the process of adapting to different engines, this Cheat Sheet will have updates over time. It is more for my personal use but hopefully, it will help others as well.
Single Line Comments/Remarks:
GDScript: #
C#: //
C++ : //

Multiline Comments/Remarks:
GDScript: """ """ (works only in v3.0 otherwise highlight comments and press ctrl+/)
C#: /* */
C++: /* */ or /* //*/
GDScript: var myString = "Hello World" // (no Line Ending Symbol)
C#: string myString = "Hello World";
C++: char myString[] = "Hello World";

GDScript: var myInt = 0 //(No Line End Symbol)
C#: int myInt = 0;
C++: int myInt = 0; // (remember about Integer/String and Char length restrictions in C++)
GDScript: var myFloat = 0.1 //(Again No Line Ending)
C#: float myFloat = 0.1;
C++: float myFloat = 0.1; // Don't forget to ensure it does not exceed length limit.

GDScript: var myBool = true //(no line ending symbol)
C#: bool myBool = true;
C++: bool myBool = true;
GDScript: const myConstant = 500 //(no line ending symbol)
C#: const int myInt = 0;
C++: const int myInt = 0;

GDScript: var myArray = ['String',1,true,0.1,"Other String"]
C#: int[] myIntArray = {0,1,2,3,4,5,6,7,8,9,10}; //must be of declaration type.
C++: int myIntArray[] = {0,1,2,3,4,5,6,7,8,9,10}; //must be of declaration type.
GDScript: var myDictionary ={
"One": 1,
"Two": 2,
"Three": 3

C#: Dictionary<string, string> myDict = new Dictionary<string, string>
            { "key1", "value1" },
            { "key2", "value2" }
        }; // can change either of types defined in Dictionary <string, string> so you may use and int and an int instead or a string and an int.

C++: std::map<int, std::string> myDictionary; // same rules apply from C# regarding the types defined. 


Most Popular