The unless block doesn't support nesting if statements. Consider this,
unless 'a' == 'b'
if 1 == 2
echo 'nope'
else
echo 'yup'
end
end
This code doesn't compile, instead produces the following error.
/home/dms/.rbenv/versions/1.9.3-p429/lib/ruby/gems/1.9.1/gems/riml-0.3.1/lib/nodes.rb:31:in `method_missing': undefined method `non_nested?' for #<Riml::UnlessNode:0x00000001e0afa0> (NoMethodError)
This is not a major bug since such unless blocks are usually at the top of a function to return early. I needed to do some additional checks in one particular scenario when I came across this bug. Switching to an if with a negative equality works.
The
unless
block doesn't support nesting if statements. Consider this,This code doesn't compile, instead produces the following error.
This is not a major bug since such unless blocks are usually at the top of a function to
return
early. I needed to do some additional checks in one particular scenario when I came across this bug. Switching to anif
with a negative equality works.