In godot oyu use match
statement. It's the equivalent of the switch
statement found in many other languages.
Basic syntax:
match [expression]:
[pattern](s):
[block]
[pattern](s):
[block]
[pattern](s):
[block]
example:
match typeof(x):
TYPE_REAL:
print("float")
TYPE_STRING:
print("text")
TYPE_ARRAY:
print("array")
for more information go to GDScript docs have the 'Match' keyword