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

Reference: Python Doc↗.

Perl

# perl

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

Reference: perldoc perlsyn↗.


Page created: 2005-01.
© 2005 by Xah Lee.
Xah Signet