Hi all,
I'm teaching myself perl. Right now, I am stuck with this script. I
don't understand how it works. I know what it does and how to do it by
hand.

$n = 1;
while ($n < 10) {
    $sum += $n;
    $n += 2;
}
print "The sum is $sum.\n"

I know $sum is initially 0 (undef). I see that $sum becomes 1, then $n
becomes 3. The loop goes back and then I don't understand. Now $sum is
1+3?

Thanks,
JJ

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to