Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Re: Re: Auto-increment frenzy

by Chady (Priest)
on Aug 27, 2003 at 07:59 UTC ( #286967=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Auto-increment frenzy
in thread Auto-increment frenzy

the first $a++ assigns 2 to $a, the second $a++ assigns 3, and then $a = 3 + 2
well, I would expect that the post increment actually postincrements:
$a++ returns $a and increments after that; so the first $a++ returns 1 and now $a is 2, the second increment returns 2 and makes $a = 3
so the addition returns 1 + 2 = 3.
He who asks will be a fool for five minutes, but he who doesn't ask will remain a fool for life.

Chady | http://chady.net/

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://286967]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2018-07-16 20:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (349 votes). Check out past polls.

    Notices?