Nature of Functions


☞ Function can be of any one nature from the following :

1. Takes Nothing Return Nothing
2. Takes Nothing Return Something
3. Takes Something Return Nothing
4. Takes Something Return Something

Takes Nothing Return Nothing

def  add( ):
     a=5
     b=6
     c=a+b
     print(c)

#__main_program
add( )

Takes Nothing Return Something

def  add( ):
     a=5
     b=6
     c=a+b
     return c         # return(c) you can also write like this

#__main_program
result=add( )
print(result)

Takes Something Return Nothing

def  add(a,b):
     c=a+b
     print(c)

#__main_program
add(5,6 )

Takes Something Return Something

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

#__main_program
result=add(5,6)
print(result)