Articles added in Mathematics Lab | Cyber Lab is now open | Astronomy Lab is now open | VLSI Lab is now open | 120 SEO Tips article published | More exciting articles coming soon!


  • A function is a set of code that is executed repeatedly whenever it is called.



    NOTE: Function names are case insensitive.

    Parameters can be passed to functions:

  • Arguments can be passed to the functions and arguments are nothing but information passed to a function. Arguments are specified inside parentheses. We can have as many arguments as we want but they have to be separated by commas.

  • E.g.:
  • In the above example, 2 parameters are passed to the function info.


  • When no parameter is passed to the function then it takes default values.

  • E.g.:

  • The arguments passed to the function are called as actual parameters and the other set of parameters which are present in the function definition are called as formal parameters.

  • If the number of parameters passed by the calling function are more, then the extra arguments are simply ignored, but if it is less then it generates a warning.

  • The variable name of the actual and formal parameter can be the same.

  • Return Statement:

  • A function returns a value through the return statement.

  • E.g:
  • Here the return statement will return the value 7 to $k.

  • NOTE: As soon as the return statements is encountered the execution of the function stops.

    CACKLE comment system

    Programming Resources
    Computer Networking Fundamentals Android Application