Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Boolean counter?

by rowdog (Curate)
on Dec 07, 2009 at 22:11 UTC ( #811634=note: print w/ replies, xml ) Need Help??


in reply to Boolean counter?

I tend to use $toggle *= -1;

Update: I stand corrected, thanks LanX. I often use that for alternating rows but it's wrong here.


Comment on Re: Boolean counter?
Download Code
Re^2: Boolean counter?
by LanX (Canon) on Dec 07, 2009 at 23:09 UTC
    well it's a toggle but can't be used as boolean as the OP wanted , since 0*-1=0

    Cheers Rolf

Re^2: Boolean counter?
by Ratazong (Prior) on Mar 03, 2015 at 15:48 UTC

    Your idea works the following way - even if it doesn't look as elegant any more:

    $toggle = -1 * ($toggle - 0.5) + 0.5;
    Rata (loving this thread)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://811634]
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 2015-07-02 00:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (25 votes), past polls