I'd rather use:<div><br></div><div>def some_other_method</div><div>  return foo.whatever if foo</div><div>  return bar.whatever if bar</div><div>  "some message"</div><div>end</div><div><br><br><div class="gmail_quote">
On 3 August 2011 12:23, Viktor Tron <span dir="ltr"><<a href="mailto:viktor.tron@gmail.com">viktor.tron@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
yes with no value, case becomes a concise way of writing if .. elsif .. elsif conditionals<br>
since simon's code is of this type, the bug he gets is a bug you expect with the<br>
case nil variant unless somewhere case is redefined to fall back to nil with no args<br>
Simon, is this not the 'case'? :)<br>
<br>
a little simplified irb for you:<br>
<br>
ruby-1.9.2-p180 :001 > case nil when nil then true else false end<br>
 => true<br>
ruby-1.9.2-p180 :002 > case when nil then true else false end<br>
 => false<div><div></div><div class="h5"><br>
<br>
<br>
On Wed, 03 Aug 2011 12:15:38 +0100, Tom Stuart <<a href="mailto:tom@therye.org" target="_blank">tom@therye.org</a>> wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
On 3 Aug 2011, at 12:12, Matthew Rudy Jacobs wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
On 3 August 2011 12:09, Tom Stuart <<a href="mailto:tom@therye.org" target="_blank">tom@therye.org</a>> wrote:<br>
<br>
See page 141 of the pickaxe for this use of case.<br>
<br>
Cheers,<br>
<br>
Tom<br>
<br>
Please enlighten me, then.<br>
What's the usecase?<br>
<br>
Have never seen this done.<br>
</blockquote>
<br>
According to the Pickaxe '[this] form is fairly close to a series of if statements; it lets you list a series of conditions and execute a statement corresponding to the first one that's true."<br>
<br>
The code example there is:<br>
<br>
case<br>
when <a href="http://song.name" target="_blank">song.name</a> == "Misty"<br>
  puts "Not again!"<br>
when song.duration > 120<br>
  puts "Too long!"<br>
when Time.now.hour > 21<br>
  puts "It's too late"<br>
else<br>
  song.play<br>
end<br>
<br>
It's pretty ugly, but it's valid Ruby and has nothing to do with the more usual use of case for comparison with === against multiple values.<br>
<br>
Cheers,<br>
<br>
Tom<br>
<br>
</blockquote>
<br>
<br></div></div><font color="#888888">
-- <br>
Using Opera's revolutionary e-mail client: <a href="http://www.opera.com/mail/" target="_blank">http://www.opera.com/mail/</a></font><div><div></div><div class="h5"><br>
______________________________<u></u>_________________<br>
Chat mailing list<br>
<a href="mailto:Chat@lists.lrug.org" target="_blank">Chat@lists.lrug.org</a><br>
<a href="http://lists.lrug.org/listinfo.cgi/chat-lrug.org" target="_blank">http://lists.lrug.org/<u></u>listinfo.cgi/chat-lrug.org</a><br>
</div></div></blockquote></div><br></div>