Code basics

Sean Dunn sdunn at digitalanvil.com
Fri Mar 17 11:00:28 EST 2000


while notDone:
    chip = self.getNumberOfSomething()
    if chip == 10:
        System.Out.println("Tjohoo")
    else:
        System.Out.println("Oh no!")
    #if
#while

By the way, since notDone never gets updated, this will run forever, or not
run at all.
Also, the #if  and #while  are not even required - but I put these everywhere
because coming from a C(++) background myself, it really makes Python easier
to read for me.  All that is required for "blocking" is that the code be in
the same column.

Sean


JJ wrote:

> I'm a C/C++/Java programmer and wonder how to make "code blocks" in Python.
>
> Please translate this to Python:
>
> while( notDone )
> {
>     int chip = this.getNumberOfSomething();
>     if (chip == 10 )
>     {
>         System.out.println("Tjohoo");
>     }
>     else
>     {
>         System.out.println("Oh no!");
>     }
> }
>
> // Joacim

--
Sean Dunn
Digital Anvil
VFX Software Engineer                  This sentence is false.
--


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20000317/0747f48e/attachment.html>


More information about the Python-list mailing list