What is the difference between void and formal non void function? Explain with examples. in Python
Answers
Answered by
2
Answer:
The way that a non-void method is called differs from the way that a void method is called in that the call is made from within other Java statements. Since a non-void method always returns a value, this value has to be stored in a variable, printed, or returned to a Java control structure or another method.
Since nothing was returned to the variable, Python printed ''None'' to the console. Such functions which do not have a return statement in them are called void functions. Void functions are those that do not return anything. ''None'' is a special type in Python, which is returned after a void function ends
Attachments:
Similar questions