HomeMathComputingArtsWordsLiteratureMusictwitter facebook webfeed

Perl & Python: “while” Loop Example

Advertise Here For Profit

Xah Lee, 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

blog comments powered by Disqus