[Tutor] defining functions

Sean 'Shaleh' Perry shalehperry@attbi.com
Sun, 09 Dec 2001 23:07:00 -0800 (PST)


$ python /tmp/foo.py 
Traceback (most recent call last):
  File "/tmp/foo.py", line 1, in ?
    foo()
NameError: name 'foo' is not defined
$ cat /tmp/foo.py 
foo()

def foo():
        print "foo"

looks like you have to define it before you use it (-:  That wasn't too hard.