- Author: Denis Morozov
- Organization: Matrix.org
- Proposal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
switch "a"..."z" { | |
case "x": | |
print("Stranger things") | |
default: | |
break | |
} | |
if case "x" = "a"..."z" { | |
print("Stranger things") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Foo { | |
let name: String | |
} | |
func ~=(pattern: String, value: Foo) -> Bool { | |
return pattern == value.name | |
} | |
let foo = Foo(name: "foo") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
switch 5 { | |
case 0...10: | |
print("Range contains value") | |
default: | |
break | |
} | |
if case 0...10 = 5 { | |
print("Range contains value") | |
} |