Created
August 18, 2014 23:15
-
-
Save davidstump/a9ec98497b741b0a5e80 to your computer and use it in GitHub Desktop.
Swift and Elixir
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
// Elixir | |
case {1, 2, 3} do | |
{4, 5, 6} -> | |
"This clause won't match" | |
{1, x, 3} -> | |
"This clause will match and bind x to 2 in this clause" | |
_ -> | |
"This clause would match any value" | |
end | |
// Swift | |
switch (1, 2, 3) { | |
case (4, 5, 6): | |
println("This clause won't match") | |
case (1, let x, 3): | |
println("This clause will match and bind x to 2 in this clause") | |
case _: | |
println("This clause will match any value") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment