Functions in programming are modular units of code designed to perform specific tasks.
They encapsulate a set of instructions, allowing for code reuse and organization.
table by: https://generalistprogrammer.com/cheatsheets/godot-gdscript
| Code | Description | Example |
|---|---|---|
| func function_name(params): | Define function | |
| func name() -> Type: | Function with return type | |
| func name(param = default): | Function with default parameters | |
| return value | Return value from function | |
| pass | Empty function body placeholder | |
| static func name(): | Static function (callable without instance) | |
| func _ready(): | Called when node enters scene tree | |
| func _process(delta): | Called every frame | |
| func _physics_process(delta): | Called every physics frame (fixed timestep) | |
| func _input(event): | handles input events | |
| func _unhandled_input(event): | Handle input not consumed by UI | |
| func _enter_tree(): | Called when node enters tree (before _ready) | |
| func _exit_tree(): | Called when node exits tree |