Last active
August 29, 2015 14:02
-
-
Save kaja47/482a80a4054bb4572cc5 to your computer and use it in GitHub Desktop.
scala vs. swift (round 1)
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
let yetAnotherPoint = (1, -1) | |
switch yetAnotherPoint { | |
case let (x, y) where x == y: | |
println("(\(x), \(y)) is on the line x == y") | |
case let (x, y) where x == -y: | |
println("(\(x), \(y)) is on the line x == -y") | |
case let (x, y): | |
println("(\(x), \(y)) is just some arbitrary point") | |
} |
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
val yetAnotherPoint = (1, -1) | |
yetAnotherPoint match { | |
case (x, y) if x == y => | |
println(s"(${x}, ${y}) is on the line x == y") | |
case (x, y) if x == -y => | |
println(s"(${x}, ${y}) is on the line x == -y") | |
case (x, y) => | |
println(s"(${x}, ${y}) is just some arbitrary point") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment