drag to orbit · scroll to zoom
← Playground

📬 Mail Sorter · match/case

A letter carries a value. The sorter drops it into the one slot that matches. No match? It falls into the default slot (case _).

Letter value
Pick a value, then sort the letter into its matching slot.
Python code
match letter: case "red": # top slot case "green": # second slot case "blue": # third slot case _: # default slot

💡 ⚠️ This is not like a traffic light! A traffic light cycles red→green→yellow in order. match/case picks the one slot that equals the value — no order, no cycling.