Python Forum
Starting to use functions help
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Starting to use functions help
#4
The function usually returns an object. If don't need to it returns None. Return statement is doing the job.

>>> def add(a, b):
...
...     # c = a + b
...     # return c
...     return a + b

>>> print(add(40, 22))
62
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply


Messages In This Thread
Starting to use functions help - by Miraclefruit - Mar-22-2017, 02:39 AM
RE: Starting to use functions help - by wavic - Mar-22-2017, 07:08 AM
RE: Starting to use functions help - by zivoni - Mar-22-2017, 08:52 AM
RE: Starting to use functions help - by wavic - Mar-22-2017, 09:01 AM
RE: Starting to use functions help - by nilamo - Mar-22-2017, 04:05 PM

Forum Jump:

User Panel Messages

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