Table of Contents
show
- A function is a block of code which only runs when it is called
- Function is a sub program which consists of set of instructions used to perform a specific task
- A large program is divided into basic building blocks called function
Use of Function
- When the program is too complex and large they are divided into parts. Each part is separately coded and combined into single program. Each subprogram is called as function
- Debugging, testing and maintenance becomes easy when the program is divided into subprograms
- Functions are used to avoid rewriting same code again and again in a program
- Function provides code re-usability
- The length of the program is reduced
Types of function
Functions can be classified into two types,
- Built in Function
- User Defined function
Views: 0