Presentation is loading. Please wait.

Presentation is loading. Please wait.

A function is a group of statements that exist within a program for the purpose of performing a specific task. We can use functions to divide and conquer.

Similar presentations


Presentation on theme: "A function is a group of statements that exist within a program for the purpose of performing a specific task. We can use functions to divide and conquer."— Presentation transcript:

1

2 A function is a group of statements that exist within a program for the purpose of performing a specific task. We can use functions to divide and conquer a task

3

4 Benefits Simpler Code: Code is easier to read and understand.
Code Reuse: Functions reduce duplication of code, if a specific operation is performed multiple times, it can be written once and used over and over again. Better Testing: With each task in its own block, its easier to test and develop. Faster Development: If a programmer has to develop multiple programs, and he discovers that certain tasks are common to them, he can write a function or functions to perform those tasks and reuse them. Easier Facilitation of Teamwork: Functions make it easier to do collaboration.

5

6

7 What mistake can we find in the following code?

8 Scope and Local Variables

9 Passing Arguments to Functions

10

11

12

13

14

15

16

17

18


Download ppt "A function is a group of statements that exist within a program for the purpose of performing a specific task. We can use functions to divide and conquer."

Similar presentations


Ads by Google