diff options
Diffstat (limited to 'Python Match statements.md')
-rw-r--r-- | Python Match statements.md | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Python Match statements.md b/Python Match statements.md new file mode 100644 index 0000000..8a4ead6 --- /dev/null +++ b/Python Match statements.md @@ -0,0 +1,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 +```
\ No newline at end of file |