Les conditions et les boucles

exemple

if user_answer == "B" and my_var == 1:
# leave the condition
pass
elif user_answer == "C" or my_int = 5:
do_something()
else:
do_something_else()
# tests if a value is in an array
var my_array = [1, "cat", false, 18.56, 'whatever']
if my_var in my_array:
do_something()
else:
do_something_else()
# test for an empty array
if not my_array:
# my_array is empty
for quote in quotes:
quote.capitalize()
var y = [1,2,3,4]
for x in y:
print(x)
for x in range(8):
print(x)
while x < 10:
print(x)
# skip the end of a block (on an if or in a loop)
continue
# BREAK the block and go to next line (on an if or in a loop)
break

Les fonctions

exemple

func get_random_item_in(my_list)->void:
# TODO: get a random number
item = my_list[0] # get a quote from a list
print(item) # show the quote in the interpreter
return "program is over" # returned value

Les objets

extends Node
# Declare the class name here, add a comma and an optional path to an image to use as an icon
class_name ScriptName, "res://path/to/optional/icon.svg"
func _ready():
var this = ScriptName # reference to the script
var cppNode = MyCppNode.new() # new instance of a class named MyCppNode
cppNode.queue_free()