Code basics

JJ joacim at home.se
Fri Mar 17 10:32:14 EST 2000


Thanks,
I miss the curly braces but I'll get used to it ;-)

// Joacim

"Darrell" <darrell at dorb.com> wrote in message
news:r6sA4.24286$W5.355921 at typhoon.nyroc.rr.com...
>
> "JJ" <joacim at home.se> wrote in message
> news:8ath59$c7i$1 at vg170.it.volvo.se...
> > 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!");
> >     }
> > }
> >
>
> while notDone:
>     chip = self.getNumberOfSomething()
>     if chip == 10:
>         print "Tjohoo"
>     else:
>         print "Oh no!"
>
>
> NOTE: Indenting replaces the curly braces, so don't delete white space.
> NOTE: self must be passed as the first parm of a method.
>
> def jumpTheJavaGuy(self, parm1):
>     """
>     Doc string here
>     """
>     while notDone:
>         ......
>
>
> Once-you-try-the-snake-you-won't-go-back
> --Darrell
>
>





More information about the Python-list mailing list