Answers for "gdscript assert"

0

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
Posted by: Guest on April-14-2021

Browse Popular Code Answers by Language