func some_function(param1, param2:String, param3:int = 3):
const local_const = 5
var local_var = param1 + 3
return local_var
# First-class Functions and Lambdas! (New in Godot 4.x!!)
var test_var = func(x):
return x >= 0
# test_var:Callable <--------- it's a callable object!!
print(test_var.call(8)) # true
test_var = func is_negative(x):
return x < 0
print(test_var.call(-4)) # true
# These are functions that may be assigned to variables
# and passed as arguments to other functions.
# They may also be returned from functions.
# They are defined in the same way as regular
# functions but in the place of where an expression
# would normally be.