[Tutor] while with function

alan.gauld@bt.com alan.gauld@bt.com
Sun Nov 17 12:41:01 2002


Once I fixed the broken syntax:

> def getnum():
              ^ colon needed
>    x=int(raw_input("get number: ") )
                                     ^ extra paren needed
>    return x
> 
> y=0
> while y==0:
>    y=getnum()
>    print y

It worked as expected.

Alan G.