spiccioni has asked for the wisdom of the Perl Monks concerning the following question:
The output is:$n=0; print ($n,"\n"); while ($n<1){ $n=$n+.1; print ($n,"\n"); }
Since the while condition is that n should be less than 1, I don't understand why the loop is entered for a last time when the value of n is 1, so that the value 1.1. is printed.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 1.1
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: non-integer increments
by fglock (Vicar) on Dec 02, 2004 at 15:50 UTC | |
|
Re: non-integer increments
by xorl (Deacon) on Dec 02, 2004 at 15:54 UTC | |
by ikegami (Patriarch) on Dec 02, 2004 at 16:03 UTC | |
by demerphq (Chancellor) on Dec 02, 2004 at 16:35 UTC | |
by si_lence (Deacon) on Dec 02, 2004 at 16:25 UTC |