[Tutor] Return T/F vs print T/F

Brett Ritter swiftone at swiftone.org
Sat Feb 4 19:58:18 CET 2012

On Sat, Feb 4, 2012 at 11:42 AM, Sivaram Neelakantan
<nsivaram.net at gmail.com> wrote:
> On Sat, Feb 04 2012,bob gailer wrote:
>> On 2/4/2012 9:38 AM, Sivaram Neelakantan wrote:
>>> While trying out code, I have trouble following the difference between
>>> return True vs print True and the same with False.  If I use return
>>> for the True/False statements, nothing gets printed.  Why?
>> Why did you expect something to be printed?
> err...return sends something back as in True or False?

Yes, it returns it to the caller.  It doesn't print it.

When using the interactive mode, the program that creates that mode
prints the return.  When you are using it your program, the caller
decides what to do.

The flip side is that printing a value does NOT return it.

Brett Ritter / SwiftOne
swiftone at swiftone.org

More information about the Tutor mailing list