Subprograms

Fill in the blanks

Sub-programs, also known as , are self-contained blocks of code that perform a within a larger program. They are designed to enhance modularity, reusability, and maintainability of code. Subprograms are first within the program. Once the function has been defined, it can be executed anywhere within the program by the function, usually by writing the subprogram name followed by parentheses.



A function is a type of subprogram that returns a after execution, which can be used elsewhere in the program. Since functions return values, they can be used within expressions (e.g., mathematical calculations). In contrast, a procedure is a block of code that performs a task but does not return a value. Procedures are often used for performing actions like , modifying global variables, or interacting with the user.



Subprograms allow for the division of complex tasks into smaller manageable units, making the code easier to understand and . They can be reused in different parts of the program or in other programs, eliminating the need for duplicating code and saving . Moreover, subprograms reduce complexity by hiding the details of their , allowing the programmer to focus on the high-level functionality. Additionally, they help in organizing code into logical sections, making it easier to and debug.

Keywords

calling | maintain | defined | specific task | printing | value | navigate | implementation | subroutines | development time |