Created
August 12, 2008 21:17
-
-
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
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
#!/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