return values from a function

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • techyvibe
    New Member
    • Feb 2008
    • 5

    return values from a function

    How do we return a value from a function i.e from a subfunction to a main function?
  • dshimer
    Recognized Expert New Member
    • Dec 2006
    • 136

    #2
    There are plenty of considerations that would make this a bad example but the simple answer is just use "return"
    Code:
    >>> def return_value(number):
    ... 	return number*2
    ... 
    >>> return_value(5)
    10
    Originally posted by techyvibe
    How do we return a value from a function i.e from a subfunction to a main function?

    Comment

    Working...