Last active
May 16, 2019 06:25
-
-
Save 284km/74d9869a5f789e6c7750f91bad4726a4 to your computer and use it in GitHub Desktop.
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
# Q1 | |
"Hello world".then do | |
# case x = 1.010101 | |
case x = 1..010101 | |
in ^x | |
puts "Goodbye world" | |
end | |
rescue NoMatchingPatternError | |
puts @1 | |
end | |
# Q2 | |
def say | |
Proc.new | |
end | |
# greeting = say { | |
greeting = say &{ | |
case "Hello world" | |
in x => y if x = 1 | |
then | |
1 | |
else | |
0 | |
end & 1 => y | |
} | |
puts greeting.call(1) | |
# Q3 | |
# ?...?.?%??.:puts.:[]==="Hello world":%?? | |
?...?.?%??.:puts.:[] ==="Hello world":%?? | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment