State machine

Applies to: general, cpp, c, robotics

A state machine stores the current mode and changes behavior based on events or conditions.

switch (mode) { case Mode::Run: break; }

See also: enum-class, conditional