zapdos has asked for the wisdom of the Perl Monks concerning the following question:
$count = 0; while ($count < 10) { $count += 1; print "count is now $count\n"; }
I don't get it. Why is it printing till 10 if the conditional expression asserts it should be less than (<) 10 and not less than or equal (<=) to 10? Shouldn't it print just till 9?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Not understanding while loop counting (updated!)
by haukex (Archbishop) on Aug 10, 2020 at 08:14 UTC | |
Re: Not understanding while loop counting
by LanX (Saint) on Aug 10, 2020 at 08:15 UTC | |
Re: Not understanding while loop counting
by davido (Cardinal) on Aug 10, 2020 at 14:59 UTC | |
Re: Not understanding while loop counting
by pDaleC (Sexton) on Aug 10, 2020 at 14:57 UTC | |
by haukex (Archbishop) on Aug 10, 2020 at 15:09 UTC | |
by LanX (Saint) on Aug 10, 2020 at 16:34 UTC | |
Re: Not understanding while loop counting
by zapdos (Sexton) on Aug 10, 2020 at 22:55 UTC |
Back to
Seekers of Perl Wisdom