3-Functions
3-Functions
SUB ROUTINES
KALVIN KARL C. NONATO, MIT
Objectives
▷ Define Function;
▷ Differentiate pre-defined and built-in functions;
▷ Identify the different parts of a function;
▷ Declare and call a function;
▷ Differentiate a function with parameter and
parameter less;
▷ Create a function with return and no return values.
2
BUILT-IN FUNCTION
3
USER-DEFINED FUNCTION
▷ User-defined functions: A
programmed routine that has its
parameters set by the user of the
system. Functions created by the
user or programmer.
4
What is a Function?
6
A function is named.
7
A function is independent.
8
A function performs a specific task
10
SYNTAX:
11
Access Modifier
12
Function Return Type
13
Function name
14
Argument
15
Parameter
16
Predefined rules in naming a function:
17
USING NO PARAMETER AND RETURN TYPE
18
USING PARAMETER BUT NO RETURN TYPE
19
USING PARAMETER AND RETURN TYPE
20
USING PARAMETER BUT NO RETURN TYPE
21
USING PARAMETER AND RETURN TYPE
22