Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python match statement

# Only supported 3.10+

# _ is the symbol for wildcard
match value:
  case Case1:
    ...
  case Case2:
    ...
  case (5, _): # if value is some tuple with first element 5
    ...
  case _: # you can implement a fall-through like this
    ...
 
PREVIOUS NEXT
Tagged: #python #match #statement
ADD COMMENT
Topic
Name
1+2 =