Skip to reading
GDScript Programming & Godot

GDScript quick reference

Edition 0.86.4.1 HF1

0.86.4.1 Hotfix 1 edition. Earlier lessons and screenshots retain their original version context; revised references and supplements describe the newer behavior.

Download PDFView PDF page

Earlier edition reference / Current 0.86.4.0 property paths > p. 350

Source table from GDScript quick reference, page 328
JobNative GDScript form
Comment# comment; not //
Declarationvar count: int = 0 or var count := 0
Constant / enumconst LIMIT = 10; enum State { LOCKED, OPEN }
Functionfunc name(value: int = 1) -> int: followed by an indented body
Decisionif / elif / else, each with a colon
Conditional valuea if condition else b
State selectionmatch with indented patterns and _ fallback
Loopfor value in collection / range; while condition
Loop controlbreak / continue
Function exitreturn / return value
Array[1, 2], Array[String], append/size/has
Dictionary{"open": false}, get/has/keys/erase
Waitawait signal or await coroutine_call()
Signalsignal declaration; connect Callable; emit(arguments)
Inheritanceextends one base; super calls parent
Reusepreload/load for files; CallScript/IncludeScript for PCA records
Native contextself = Node instance; this = PCA caller proxy; player = character proxy

Case matters. Godot native globals usually use lowercase snake_case. PCA helpers/actions use the capitalized names in their reference. Dictionary keys keep their own exact spelling.

Page 328 of 378Permalink
Go to page