Hi, the following code does not "compile":
-----------------------------
def test1
value = return("lalala")
end
-----------------------------
=> SyntaxError: (irb):11: void value expression
Ok, it makes sense. So then, why the following does not fail?
-----------------------------
def test2
value = case 123
when Fixnum
return "returning 'Fixnum' string from method test2"
end
puts "method test2 ends now"
end
--------------------------
irb> test2
=> "returning 'Fixnum' string from method kk"
I'm using Ruby 1.9.2 and in fact I use a method like "test2" it in my
project, but it seems a bit strange for me and I would like to be sure
that it's something correct (even if IMHO it does not make sense) and
will not change in a future Ruby 1.9 version.
Thanks a lot.
--
IƱaki Baz Castillo
<ibc / aliax.net>