AI Features

How Functions Work?

This lesson helps us understand how a function works i.e., how a function is called, how it performs the task and how it returns the result.

Calling a function

Starting a function so that it achieves its task is called calling a function. The function call syntax is the following:

function_name(parameter_values)

The actual values that are passed to functions are called function arguments. Although the terms parameter and argument are sometimes used interchangeably in the literature, they signify different concepts.

The arguments are matched to the parameters one by one in the order that the parameters are defined. For example, the last call of printMenu() in the previous lesson uses the arguments Return and 1, ...