Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^3: Wrong idioms

by LanX (Canon)
on Mar 31, 2013 at 00:33 UTC ( #1026311=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Wrong idioms
in thread Wrong idioms

Update: Post recomposed for better readability

> Also - what other languages treat "0" as false?

  • JavaScript

    Num yes Str no

    >>> !! 0 false >>> !! "0" true

  • Python

    Num yes Str no

    >>> not not 0 False >>> not not "0" True

  • Ruby

    Num no Str no

    irb(main):002:0> !! 0 => true irb(main):003:0> !! "0" (irb):3: warning: string literal in condition => true

  • Perl

    Num yes Str yes

    DB<102> !! 0 => "" DB<103> !! "0" => ""

    Cheers Rolf

    ( addicted to the Perl Programming Language)


  • Comment on Re^3: Wrong idioms
    Select or Download Code

    Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Node Status?
    node history
    Node Type: note [id://1026311]
    help
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others making s'mores by the fire in the courtyard of the Monastery: (9)
    As of 2014-12-25 00:42 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      Is guessing a good strategy for surviving in the IT business?





      Results (159 votes), past polls