Skip to content

Latest commit

 

History

History
13 lines (10 loc) · 266 Bytes

File metadata and controls

13 lines (10 loc) · 266 Bytes

structural pattern matching

Python 3.10 match/case supports structural pattern matching with guards.

match command:
    case ['go', direction] if direction in VALID:
        move(direction)
    case _:
        print('unknown')

Learned on 2025-05-07