in reply to RE(2): Flipper (Maintainability vs. personal style?)
in thread Flipper
> I guess my question is: why do you think I am throwing
> away a result which you only accomplish differently?
> "++" vs. "+ 1" -- they both add one to the value
> of $flip.
does not change in any way the scalar referred to by $flip, while "++$flip" does. Simple as that.$flip + 1;
=== What, fundamentally, is the difference between $flip = ++$flip % 4 and $flip = ($flip + 1) % 4 ===The first changes the value of $flip twice, the second, only once. In the first one, the computer is saying:
- Increase the value of $flip by one
- Modulo 4 it
- Assign the result into $flip
- Compute the value of $flip + 1
- Modulo for that (temporary) value
- Assign the result into $flip
|
---|
Replies are listed 'Best First'. | |
---|---|
RE:(4) Flipper (++ instead of += 1)
by Russ (Deacon) on May 22, 2000 at 04:58 UTC |
In Section
Cool Uses for Perl