Functions & Procedures

Fill in the blanks

In programming, a is a sequence of instructions that perform a specific task. It can be defined using the keyword "" and can accept s, which are also referred to as s. Parameters are variables declared within the parentheses of a function definition and are used to pass values into the function. These values can be retrieved and manipulated within the function's code.

When a procedure is executed, it may produce a result, which is known as the . The return value is typiy specified using the "return" keyword and can be assigned to a within the calling code.

Speaking of variables, a local variable is a variable declared within a function and is only accessible within the of that function. It exists for the duration of the function's execution and is discarded once the function completes. On the contrary, a is accessible from anywhere within a program and retains its value until the program terminates. However, it is generally advisable to limit the use of global variables, as they can lead to code complexity and potential bugs.

is a powerful programming technique where a function calls itself. It allows for the solution of complex problems by breaking them down into smaller, more manageable tasks. Recursion is particularly useful when solving problems with repetitive or nested structures.

is the process of breaking down a program into smaller, self-contained functions or modules. By dividing a program's functionality into smaller units, it becomes easier to manage, debug, and reuse code. Functions provide this modularization capability, allowing code to be organized in a structured and logical manner.

Scope refers to the visibility and accessibility of variables within a program. The two common types of scopes are and . Function scope means that a variable declared within a function is only accessible within that function. On the other hand, block scope refers to variables declared within a block of code, such as within loops or conditional statements, and are only accessible within that block.

Keywords

block scope | function scope | function | scope | global variable | parameter | local variable | return value | argument | call | procedure | modularization | recursion |