It's a state of mind
We can think of a state as a collection of functions that are only used when an actor is in that state. If we have an NPC in our game, then having it be "Wandering" would create very different behavior than if it were "Attacking". It's perfectly possible to have an NPC do all of this without using states, but using them makes the code a lot easier to write and change.
Creating a state
The syntax for writing a state looks a lot like a function, so it isn't much work to create them. Let's write our first state now.