List: python-list
Subject: Re: Code basics
From: "David Fisher" <python () rose164 ! wuh ! wustl ! edu>
Date: 1999-03-17 15:31:02
[Download RAW message or body]
Hi JJ,
You indicate a block with indentation. Like so:
while notDone:
chip = self.getNumberOfSomething()
if chip == 10:
print "Tjohoo"
else:
print "Oh no!"
I changed the this to self because thats the usual way of calling an
instance method. Just pretend there's a class floating just off screen that
this is inside of.
Good luck,
David
ps. I've got a gun to my head. If this turns into a whitespace thread, the
white boy gets it!
----- Original Message -----
From: "JJ" <joacim@home.se>
Newsgroups: comp.lang.python
To: <python-list@python.org>
Sent: Friday, March 17, 2000 8:57 AM
Subject: Code basics
> 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!");
> }
> }
--
http://www.python.org/mailman/listinfo/python-list
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic