Re-cap and re-group

That pretty much covers the basics of state diagrams. A state diagram lets you design the logic of a Finite State Machine (FSM). FSMs are an excellent tool for desiging programs that must respond to external events in a way that depends on past history (the context).

The key elements of a state diagram are:

Next, I will show you how a Finite State Machine can be coded in a couple of languages.