Fruitful functions and void functions in python

Page Contents:

Fruitful Function:
Return Statement:
The return none(Empty return):
Return value
Return fruitful return
What is the void function in Python?

Fruitful Function:

So before explaining to you that what is a fruitful function? First, we will talk about what is the meaning of “fruitful” it is an English word which means an advantage. For example Let, we say that this tutorial is returning knowledge to you. So for fruitful function the function which returns back a value they are called as “fruitful function

In many programming languages, a function that doesn’t return any value is called a procedure. The return statement is followed by an expression which is evaluated its result is returned to the called as the “fruit” of calling function

Return Statement:

  • The calling function generates a return value, which is usually assigned to a variable or used as a part of an expression
  • The return statement is also used to exit a function and go back to place from where it was called

The syntax for the return statement is given below


The return none(Empty return):

If there is no expression in the statement or the return statement itself, then the function will return the none object, where none means nothing

def vehicle(): pass 
a = vehicle() 
print a 



Return value

  • The return value may or may not be assigned to another variable in the caller
  • Once the value is returned in the form of function, it immediately exits that function
  • Therefore any code was written after the returned statement is never executed

for example, executing a program regarding the return value statement:

import math
def square(r)
return a
r=int(input("Enter a number"))


Enter a number :2

Return fruitful return

  • In a fruitful function, the return statement includes an expression
  • fruitful return means “Return” immediately from this function and uses the following expression and use the following expression as a return value

What is the void function in Python?

  • The function that doesn’t have a return type or a return value is known as void functions
  • We can make our function with specific return types by using the return statement in python programming
  • The void function is used for its side effects

Difference between void and fruitful function in python

The main difference between void and fruitful function in python is given below:

  • void doesn’t return any value
  • fruitful function return value

Translate »