Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Def - Return Question
#2
The return statement does just that - returns selected the result of the processing within a function.

So, if you don't need any of the data produced in a function, you are not obligated to use it at at all - by default, functions return None in Python

You also don't have to use the returned value in the calling code - you may have a function that returns result, and sometimes this result is discarded.
Test everything in a Python shell (iPython, Azure Notebook, etc.)
  • Someone gave you an advice you liked? Test it - maybe the advice was actually bad.
  • Someone gave you an advice you think is bad? Test it before arguing - maybe it was good.
  • You posted a claim that something you did not test works? Be prepared to eat your hat.
Reply


Messages In This Thread
Def - Return Question - by tryingtolearnpython - Jul-01-2018, 08:11 AM
RE: Def - Return Question - by volcano63 - Jul-01-2018, 09:33 AM
RE: Def - Return Question - by tryingtolearnpython - Jul-01-2018, 11:04 AM
RE: Def - Return Question - by volcano63 - Jul-01-2018, 12:39 PM
RE: Def - Return Question - by tryingtolearnpython - Jul-04-2018, 03:13 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020