[perl-python] 20050112 while statement

brianr at liffe.com brianr at liffe.com
Thu Jan 13 08:05:16 EST 2005


"Xah Lee" <xah at xahlee.org> writes:

> # here's a while statement in python.
>
> a,b = 0,1
> while b < 20:
> print b
> a,b = b,a+b
>
> ---------------
> # here's the same code in perl
>
> ($a,$b)=(0,1);
> while ($b<20) {
> print $b, "\n";
> ($a,$b)= ($b, $a+$b);
> }

That python code produces a syntax error:

  File "w.py", line 3
    print b
        ^
IndentationError: expected an indented block

So, not the same then!

(As a matter of interest, is this sequence of posts intended to
demonstrate ignorance of both languages, or just one?)

-- 
Brian Raven
If you write something wrong enough, I'll be glad to make up a new
witticism just for you.
             -- Larry Wall in <199702221943.LAA20388 at wall.org>



More information about the Python-list mailing list