# Erlang gen_statem ## Metadata **Status**:: #i **Zettel**:: #zettel/fleeting **Created**:: [[2025-12-26]] **Reference**:: [[Erlang Authors - gen_statem Behaviour (Highlights)]] **Topic**:: [[♯ Programming]] **Tags**:: #state-machine ## Synopsis - State + Event → State' + Actions - State transition: handle_event(event, state, data) -> {state', data', actions} - Extra works when state' ≠ state - Opt-in special event `:enter` for entering a state. - Force entering the same state using `:repeat_state`. - Possible actions: Postpone the event to next state, Time-outs, Queue internal events