Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

GLOBAL VARIABLE inside a function

• By default we can get the contents of a global variable


inside the body of a function.
• But if we want to change a global variable in a function, we
must use the global keyword.
• If you want the function to be able to modify non-local
variables, you must declare them as global in the first line
of the function.
VOID FUNCTIONS

• A function which performs an action but does not


return a value is called a void function.

• A void function internally returns legal empty value


None.
ACTUAL / FORMAL parameters

• The values provided in the brackets of the function


header are called formal parameters.
• The values that are passed to the function in the
function call statement are called actual parameters.
EXAMPLE 1

Explanation :
Output is 20 as the global variable has changed within
the function.
EXAMPLE 2
OUTPUT OF EXAMPLE 2

You might also like