If you enjoyed this site, please consider donating $3. Any amount is appreciated. Thanks!

Perl-Python Tutorial: “while” Loop Example

2005-01-12

Python

# python.

a,b = 0,1
while b < 20:
     print b
     a,b = b,a+b

Python Doc

Perl

# perl

($a,$b)=(0,1);
while ($b < 20) {
     print $b, "\n";
     ($a,$b)= ($b, $a+$b);
}

perldoc perlsyn

2005-01
© 2005 by Xah Lee.