Skip to content

Instantly share code, notes, and snippets.

@284km
Last active May 16, 2019 06:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 284km/74d9869a5f789e6c7750f91bad4726a4 to your computer and use it in GitHub Desktop.
Save 284km/74d9869a5f789e6c7750f91bad4726a4 to your computer and use it in GitHub Desktop.
# 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