[RndTbl] Funny comment
dan at martinmedcorp.com
Sat Feb 28 12:53:23 CST 2015
Ruby is less terse (I prefer to say more readable) and many of its idioms
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)
On Sat, Feb 28, 2015 at 8:53 AM, Sean Walberg <sean at 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)'
> On Sat, Feb 28, 2015 at 1:38 AM, Trevor Cordes <trevor at tecnopolis.ca>
>> 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:
>> 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 at muug.mb.ca
> Sean Walberg <sean at ertw.com> http://ertw.com/
> Roundtable mailing list
> Roundtable at muug.mb.ca
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Roundtable