[Tutor] 'return' statements

Albert Antiquera gundamone@hotmail.com
Sun, 13 Aug 2000 13:50:25 -0400


This is a multi-part message in MIME format.

------=_NextPart_000_001E_01C0052D.6E8BD960
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

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!!):

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

another example:

def julian_leap(y =3D2000):
    if (y%4) =3D=3D 0:
        return 1 <<<< I guess this says "true" but I'm not really sure
    return 0 <<< what is this returning????

I'm sorry if I've been flooding your mailboxes with questions but I =
really appreciate the help!!

Albert

URL: www.isopod-graphics.com
email: albert@isopod-graphics.com

------=_NextPart_000_001E_01C0052D.6E8BD960
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2614.3500" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>I've finished the calculator program I =
was making=20
thanks to the help of Daniel Yoo. One statement that continue to elude =
me to=20
fully understand it is the 'return' statement. On some text they said =
'return'=20
is a "goback to the start of the function" another said that it is a=20
"terminator" of a function. Can somebody explain it and please provide =
some=20
examples like when to use ' 0 ' and ' 1 ' after a return statement and =
also this=20
usage (Thanks, Daniel for this very useful function!!):</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;def=20
readNum():<BR>&nbsp;&nbsp;&nbsp;&nbsp; x =3D raw_input("Enter a value =
for=20
X:")<BR>&nbsp;&nbsp;&nbsp;&nbsp; y =3D raw_input("Enter a value for=20
Y:")<BR>&nbsp;&nbsp;&nbsp;&nbsp; return (float (x),float(y))&nbsp;&nbsp; =

&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;what exactly is return =
doing=20
here?????</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>another example:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>def julian_leap(y =
=3D2000):</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; if (y%4) =3D=3D =
0:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
return 1=20
&lt;&lt;&lt;&lt; I guess this says "true" but I'm not really =
sure</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; return 0 =
&lt;&lt;&lt; what is=20
this returning????</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I'm sorry if I've been flooding your =
mailboxes with=20
questions but I really appreciate the help!!<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Albert</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>URL: <A=20
href=3D"http://www.isopod-graphics.com">www.isopod-graphics.com</A><BR>em=
ail: <A=20
href=3D"mailto:albert@isopod-graphics.com">albert@isopod-graphics.com</A>=
</FONT></DIV></BODY></HTML>

------=_NextPart_000_001E_01C0052D.6E8BD960--