Ruby is less terse (I prefer to say more readable) and many of its idioms involve words.  
However, 
a = !!b  assigns the boolean value of b, and
a ||= b assigns b to a only if a is nil or false
(at the risk of being less readable)

-Dan

On Sat, Feb 28, 2015 at 8:53 AM, Sean Walberg <sean@ertw.com> wrote:
Thanks for pointing that out. TIL --> which is another example of "two operators smashed together does something cool". Too bad it doesn't work in Ruby, but it does in Perl:

$ perl -e '$x=3; print "hi\n" while ($x --> 0)'
hi
hi
hi

Sean

On Sat, Feb 28, 2015 at 1:38 AM, Trevor Cordes <trevor@tecnopolis.ca> wrote:
I had to confirm what $x=!!$y meant in perl.  Remarkably, typing !! or
"!!" or \!\! into google gives you nothing.  Had to use English.

Got this:

http://stackoverflow.com/questions/2168406/what-does-double-exclamation-point-mean

The +42 answer is quite good.  Exec summary: !! is good for cleaning vars
into 1 (true) or '' (false), which is important to keep warnings from
complaining about undef vars.

Anyhow, read the comments in the +42 answer.  Hehehe.

Let the flamewars begin!
_______________________________________________
Roundtable mailing list
Roundtable@muug.mb.ca
http://www.muug.mb.ca/mailman/listinfo/roundtable



--
Sean Walberg <sean@ertw.com>    http://ertw.com/

_______________________________________________
Roundtable mailing list
Roundtable@muug.mb.ca
http://www.muug.mb.ca/mailman/listinfo/roundtable