[Tutor] 'return' statements

Deirdre Saoirse deirdre@deirdre.net
Mon, 14 Aug 2000 16:02:58 -0700 (PDT)

On Sun, 13 Aug 2000, Albert Antiquera wrote:

> I've finished the calculator program I was making thanks to the help
> of Daniel Yoo. One statement that continue to elude me to fully
> understand it is the 'return' statement. On some text they said
> 'return' is a "goback to the start of the function" another said that
> it is a "terminator" of a function. Can somebody explain it and please
> provide some examples like when to use ' 0 ' and ' 1 ' after a return
> statement and also this usage (Thanks, Daniel for this very useful
> function!!):

Return returns to the calling function, with or without parameters.

>   def readNum():
>      x = raw_input("Enter a value for X:")
>      y = raw_input("Enter a value for Y:")
>      return (float (x),float(y))   <<<<<<<<<<<<what exactly is return doing here?????

In this case, it's returning two values to the function that called it:

  a, b = readNum()

_Deirdre   *   http://www.sfknit.org   *   http://www.deirdre.net
"We can always count on the British. Except for the Revolutionary War
they've been perfect." -- Mel Brooks, on the first Concorde flight since 
the Paris crash.