what is function in computer

what is function in computer

1 year ago 33
Nature

In computer programming, a function or subroutine is a sequence of program instructions that performs a specific task, packaged as a unit). Functions are "self-contained" modules of code that accomplish a specific task, and they usually "take in" data, process it, and "return" a result. Once a function is written, it can be used over and over again, and it can be called from inside other functions. Functions encapsulate a task by combining many instructions into a single line of code, and they allow us to keep our variable namespace clean.

Most programming languages provide many built-in functions that would otherwise require many steps to accomplish, such as computing the square root of a number. In general, we dont care how a function does what it does, only that it "does it". Functions are a powerful programming tool, and the syntax of many programming languages includes support for writing and using subroutines. Judicious use of functions, for example, through the structured programming approach, will often substantially reduce the cost of developing and maintaining a large program, while increasing its quality and reliability).

Read Entire Article