summaryrefslogtreecommitdiff
path: root/Python Match statements.md
blob: 8a4ead64ed9bdc2dd982c8c344c339cf8f937a3b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
---
tags:
  - python
---
```python
match var:
	case 1:
	    blaat
	case 2:
	    other
	case 3 | 4:
		combined
	case x:
		print(x) # Unpacking
	case Number(x):
		print(x)
	case Number(x) if x == 5:
		print(x) # only if x is 5
	case _:
		wildcard
```