<@U8SPC0ZTQ> When you have so many `if`s like that...
# codereview
r
@Ayden When you have so many `if`s like that, it is often wise to consider a state machine approach instead.
a
May I know how to do so?
r
It's not really a Kotlin-specific question and a lot depends on your problem. You'll find lots of information if you Google "state machine" or "finite state machine". You can implement a state machine with just
if
statements as you have done, but once the complexity reaches a certain level its usually better to abstract the state behavior. Try searching also for "state pattern".