P
planetthoughtful
Hi All,
I'm a little confused about why the following two pieces of code seem
to behave differently:
if $val =~ /this/i
puts "this"
elseif $val =~ /that/i
puts "that"
elseif $val =~ /the other/i
puts "the other"
end
if $val contains "this is the other value", for some reason "the
other" is not put by the last elseif statement. However, the following
code works as expected:
if $val =~ /this/i
puts "this"
end
if $val =~ /that/i
puts "that"
end
if $val =~ /the other/i
puts "the other"
end
Am I missing something about if / elseif in ruby?
Any help appreciated!
pt
I'm a little confused about why the following two pieces of code seem
to behave differently:
if $val =~ /this/i
puts "this"
elseif $val =~ /that/i
puts "that"
elseif $val =~ /the other/i
puts "the other"
end
if $val contains "this is the other value", for some reason "the
other" is not put by the last elseif statement. However, the following
code works as expected:
if $val =~ /this/i
puts "this"
end
if $val =~ /that/i
puts "that"
end
if $val =~ /the other/i
puts "the other"
end
Am I missing something about if / elseif in ruby?
Any help appreciated!
pt