gdscript assert code example
Example: gdscript assert
# Imagine we always want speed to be between 0 and 20
speed = -10
assert(speed < 20) # True, the program will continue
assert(speed >= 0) # False, the program will stop
assert(speed >= 0 && speed < 20) # You can also combine the two conditional statements in one check
assert(speed < 20, "speed = %f, but the speed limit is 20" % speed) # Show a message with clarifying details