Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: stupid question about switching signs every number

by psini (Deacon)
on Aug 20, 2010 at 20:27 UTC ( [id://856362]=note: print w/replies, xml ) Need Help??


in reply to Re: stupid question about switching signs every number
in thread stupid question about switching signs every number

Why use a boolean to represent a sign?

my $sum = 0; my $sign = 1; for my $i (1 .. 1000) { $sum += $sign * $i; $sum*=-1; } print $sum;

Rule One: "Do not act incautiously when confronting a little bald wrinkly smiling man."

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2024-04-20 01:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found