In return statement return exits a function, optionally passing back an expression to the caller and value. A return statement with no arguments is as same as return None and function. For example you can see below example for return statement.
# Function definition is here
def sum( arg1, arg2 ):
# Add both the parameters and return them."
total = arg1 + arg2
print "Inside the function : ", total
return total;
# Now you can call sum function
total = sum( 40, 30 );
print "Outside the function : ", total
Output:
Inside the function : 70
Outside the function : 70
0 Comment(s)