AAP-3
Programmers break down problems into smaller and more manageable pieces. By creating procedures and leveraging parameters, programmers generalize processes that can be reused. Procedures allow programmers to draw upon existing code that has already been tested, allowing them to write programs more quickly and with more confidence. | AAP-3.A
For procedure calls:
a. Write statements to call procedures. [Skill 3.B]
b. Determine the result or effect of a procedure call. [Skill 4.B] |
-
AAP-3.A.1 A procedure is a named group of programming instructions that may have parameters and return values.
-
AAP-3.A.2 Procedures are referred to by different names, such as method or function, depending on the programming language.
-
AAP-3.A.3 Parameters are input variables of a procedure. Arguments specify the values of the parameters when a procedure is called.
-
AAP-3.A.4 A procedure call interrupts the sequential execution of statements, causing the program to execute the statements within the procedure before continuing. Once the last statement in the procedure (or a return statement) has executed, flow of control is returned to the point immediately following where the procedure was called.
-
AAP-3.A.5 The exam reference sheet provides
procName(arg1, arg2, ...)
as a way to call
Text:
PROCEDURE procName(parameter1, parameter2, ...)
{
<block of statements>
}
Block:
PROCEDURE procName parameter1, parameter2,...
block of statements
which takes zero or more arguments; arg1 is assigned to parameter1, arg2 is assigned to parameter2, and so on.
-
AAP-3.A.6 The exam reference sheet provides the procedure
Text:
DISPLAY(expression)
Block:
DISPLAY expression
to display the value of expression, followed by a space.
-
AAP-3.A.7 The exam reference sheet provides the
Text:
RETURN(expression)
Block:
RETURN expression
statement, which is used to return the flow of control to the point where the procedure was called and to return the value of expression.
-
AAP-3.A.8 The exam reference sheet provides
result ← procName(arg1, arg2, ...)
to assign to result the "value of the procedure" being returned by calling
Text:
PROCEDURE procName(parameter1, parameter2, ...)
{
<block of statements>
RETURN(expression)
}
Block:
PROCEDURE procName parameter1, parameter2,...
block of statements
RETURN expression
-
AAP-3.A.9 The exam reference sheet provides procedure
Text:
INPUT()
Block:
INPUT
which accepts a value from the user and returns the input value.
|