Home Software Computer Applications What Is Term “Function” In Computer Programming

What Is Term “Function” In Computer Programming


What Is A Function

A function is automated method , procedure or module to do some job with automated manner with just call it .It may be set of commands , arguments , conditions and calculations .

It is set of instruction or code that performs a specific task and can be processed independently.

Note:  functions main features are , it works only when it calls .

For example functions code only executed when it is called . When functions are not called then codes contain place it stay neutral . It executes only when it is called .

function working
function working


Functions syntax may vary according the programming language , but working of functions is same is all programming languages.


When a program passes control to a function , then it perform that task and returns control to the instruction following the calling instruction.

Format And Syntax of  JavaScript functions

function name (arguments)
code contained in this section executed ,when function is called


<button onclick="helloMessage()">Run Function</button>
function helloMessage()
alert("Hello ! you just clicked the button");

In this example a function is created to display alert box . It is called in button tag . when user click on the “button” , code is executed and an alert message box is displayed

READ ALSO : -  Definition of built in function in programming

Check This Function’s Working

Why Required and Usage

Functions are reusable . When you create , you can call it many times in your application of webpage ,when you need it .

The most important reason to use of functions is make program handling easier  as only a small part of the program is dealt with at a time.