Skip to main content

Managing Functions

Managing functions in an application is the process of creating and maintaining chunks of codes that can be used over and over again, rather than writing repeatedly. A function is created intending to perform a single task. Functions provide better modularity for an application and a high degree of code reusability. Ultimately, functions enable the users to split a task into smaller parts, each of which performs a particular action.

Functions like print() and main() are called built-in functions, which are provided by the language itself. Apart from these, users can write their own functions as well. Once a function is created or defined, it can be called whenever required simply using its name. Additionally, in order to work, the function will probably require some inputs or parameters, which are passed to it each time it is called.

For example, 'Print' is a common built-in function that is used to display a text or message on the screen. This function can be called in a script as follows:

Here, the function is called using its name (Print) and the string parameter 'Hello World' is passed to it for printing.