Skip to content

Instantly share code, notes, and snippets.

@redsquirrel
Created March 22, 2011 21:28
Show Gist options
  • Save redsquirrel/882117 to your computer and use it in GitHub Desktop.
Save redsquirrel/882117 to your computer and use it in GitHub Desktop.
It's annoying that this is valid Ruby and prints "hi mom"
if false
elsif
print "hi "
else
puts "mom"
end
@trptcolin
Copy link

:) thinking of switching to python?

@aberant
Copy link

aberant commented Mar 22, 2011

does arranging it this way help you see what it's doing?

if false
elsif print "hi "
else
puts "mom"
end

@redsquirrel
Copy link
Author

I know what it's doing. It's just annoying.

@toothrot
Copy link

don't do that

@trptcolin
Copy link

Give in to your anger. With each passing moment you make yourself more Clojure's servant.

(cond false nil
      (print "hi ") nil
      :else (println "mom"))

Let the parens flow through you.

@aberant
Copy link

aberant commented Mar 22, 2011

this should annoy you more then...

only works in RUBY_VERSION < 1.9.x
unless(puts "hi"): puts "mom" end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment