Variables
In GDScript, variables can be declared using the var
keyword.
- Declare a variable:
var my_variable = 10
- Change the value of a variable:
my_variable = 20
- Declare a variable with a specific type:
var my_int: int = 5
Here are some common data types in GDScript:
int
: Integer numbersfloat
: Floating-point numbersbool
: Boolean values (true
orfalse
)String
: Text strings
Comments