Skip to content

Instantly share code, notes, and snippets.

@greatseth
Created August 12, 2008 21:17
Show Gist options
  • Save greatseth/5149 to your computer and use it in GitHub Desktop.
Save greatseth/5149 to your computer and use it in GitHub Desktop.
Ruby (1.8.6 at least) supports some very confusing and odd if/else/elsif behavior
#!/usr/bin/env ruby
condition = eval ENV["C"].to_s
if condition
puts "got condition"
elsif
puts "no condition, looks like elsif nothing works"
else
puts "yeah apparently you can do elsif nothing and it will run that branch and then also keep checking other if branches?"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment