Skip to content

Instantly share code, notes, and snippets.

@HoyaBoya
Last active August 29, 2015 13:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HoyaBoya/10130817 to your computer and use it in GitHub Desktop.
Save HoyaBoya/10130817 to your computer and use it in GitHub Desktop.
Print "helloworld" with the following if/else statement.
# PROBLEM
# Find an implementation of "x" that will force the code below to print "helloworld".
# SOLUTION
# This doesn't work with threads forked to return true/false. The trick is to just have x do both.
def x
print "hello"
false
end
if x
print "hello"
else
print "world"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment