Subprograms

Fill in the blanks

In , such as s and s play a pivotal role in enhancing code organization and reusability. Both and are subroutines that encapsulate a set of instructions to perform a specific task. A function is a subprogram that returns a value after its execution, while a procedure is a subprogram that does not return a value.

When defining a subprogram, s are used to specify the data the subprogram requires to execute. act as placeholders for s, which are the actual values passed to a subprogram when it is called. This allows subprograms to be flexible and applicable to different scenarios.

s are a special type of function that call themselves within their own definition. This allows for repetitive execution of the function until a specific condition is met. Recursive functions are commonly used in mathematical computations, traversing data structures, and solving complex problems.

is an important concept when talking about subprograms. The scope determines the visibility and accessibility of variables within a program. are variables defined within a subprogram and can only be accessed within that subprogram. They are temporary and their value gets erased once the subprogram execution is complete.

To interact with subprograms, two types of statements are commonly used - s and s. A return statement is used in a function to return a value back to the code that called it, while a call statement is used to invoke a subprogram and pass to it.

Keywords

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