As a beginner, I'm having trouble understanding when it'd be better to use a bunch of "ifs", and when "match" is the way to go.
I have a simple state machine in the puzzle game I'm making; just 4 possible states. Input is handled differently depending on the state the game's in. So I'm doing something like this:
func _unhandled_input(event: InputEvent) -> void:
if state == 1:
print("1")
elif state == 2:
print("2")
#etc.
Would I benefit from replacing this with "match", like so:
func _unhandled_input(event: InputEvent) -> void:
match state:
1:
print("1")
2:
print("2")
#etc.
If not, would "match" be a better choice in significantly more complex cases?