Note: This content was generated by AI. I am working on this page to provide personal content of better quality.

State

Nota bene : This content was generated by AI. I am working on this page to provide personal content of better quality.

Change object behavior when internal state changes.

Intent

Replace large if/elif chains with state classes.

Python example

Chargement…

Console output

Coin accepted Door open Coin accepted

When to use

Behavior depends on a finite state machine with explicit transitions.