Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re: Boolean counter?

by Ratazong (Prior)
on Dec 07, 2009 at 12:19 UTC ( #811486=note: print w/ replies, xml ) Need Help??

in reply to Boolean counter?

Just to show that you can make a lot with "lookup-tables" ;-)

$counter = (1, 0)[$counter];


Comment on Re: Boolean counter?
Download Code
Replies are listed 'Best First'.
Re^2: Boolean counter?
by eyepopslikeamosquito (Chancellor) on Dec 07, 2009 at 19:36 UTC

    Just to make "lookup-tables" prettier. ;-)

    $counter = [ 1 => 0 ] -> [ 1 <= $counter ];

      ug, you create two variables every time you toggle it (one of which is an array!), and you rely on the undocumented values of <= returns. And the latter doesn't help make it prettier at all!

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2015-11-26 04:34 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (696 votes), past polls