summaryrefslogtreecommitdiff
path: root/Python Match statements.md
diff options
context:
space:
mode:
authorJasper Ras <jras@hostnet.nl>2025-05-17 09:03:45 +0200
committerJasper Ras <jras@hostnet.nl>2025-05-17 09:03:45 +0200
commitd4bd3ad4a869c87fcfa4f83b42555a6c8e1bc746 (patch)
tree74cbfcd6ff623e272be389dd7d40d8e45d1f96d5 /Python Match statements.md
parent78211f96953bc1a63570f2430cee4ad92c841ce4 (diff)
vault backup: 2025-05-17 09:03:45
Diffstat (limited to 'Python Match statements.md')
-rw-r--r--Python Match statements.md21
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