diff options
| author | Zuhaitz <zuhaitz.zechhub@gmail.com> | 2026-01-25 10:46:18 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-25 10:46:18 +0000 |
| commit | f3c7b698fff7876cce26683beeee2e5e4e443962 (patch) | |
| tree | dc2d0df6cb912ec6e8811ba344f2ef358f84df27 /README.md | |
| parent | 2852e409a1acd55104aa8ed7679c566192c88607 (diff) | |
Update pattern matching syntax in README
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -350,14 +350,14 @@ var y = x > 10 ? 1 : 0; Powerful alternative to `switch`. ```zc match val { - 1 => print("One"), - 2 || 3 => print("Two or Three"), // OR with || - 4 or 5 => print("Four or Five"), // OR with 'or' - 6, 7, 8 => print("Six to Eight"), // OR with comma - 10..15 => print("10 to 14"), // Exclusive range (Legacy) - 10..<15 => print("10 to 14"), // Exclusive range (Explicit) - 20..=25 => print("20 to 25"), // Inclusive range - _ => print("Other") + 1 => { print "One" }, + 2 || 3 => { print "Two or Three" }, // OR with || + 4 or 5 => { print "Four or Five" }, // OR with 'or' + 6, 7, 8 => { print "Six to Eight" }, // OR with comma + 10 .. 15 => { print "10 to 14" }, // Exclusive range (Legacy) + 10 ..< 15 => { print "10 to 14" }, // Exclusive range (Explicit) + 20 ..= 25 => { print "20 to 25" }, // Inclusive range + _ => { print "Other" }, } // Destructuring Enums |
