Subprograms

Fill in the blanks

In , such as s and s play a crucial role. These subprograms encapsulate a set of instructions and can be called by other parts of the program. A function is a subprogram that performs a specific task and returns a value to the calling code. It typically takes s, which are variables that hold the s passed to the function when it is called. Conversely, a procedure is a subprogram that also performs a specific task but does not return a value.

When calling a function or procedure, the are the actual values passed to the . This allows us to provide different inputs and obtain different outputs based on the values passed. s are special types of that call themselves within their own code. This enables solving complex problems in a more elegant and concise manner.

The of a subprogram defines the visibility and lifetime of variables within that subprogram. are variables defined within a function or procedure and can only be accessed from within that subprogram. These variables have a limited scope, meaning they are only available during the execution of the subprogram.

To handle data flow and control between subprograms, we use statements such as the and . The return statement is utilized in functions to send back a value to the calling code. On the other hand, the call statement is used to invoke a procedure or function, passing the required arguments.

In essence, functions and , along with parameters, arguments, recursion, scope, return statements, call statements, and local variables, are fundamental building blocks of modular programming. By leveraging these concepts, we can break down complex problems into manageable sections and promote code reusability, readability, and maintainability.

Keywords

return statement | argument | arguments | local variables | procedures | subprograms | functions | parameter | recursion | recursive function | call statement | function | parameters | procedure | scope | modular programming |