English
Enduring Understanding (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.
Learning Objective 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.
ไทย
ความเข้าใจที่ยั่งยืน (AAP-3): นักพัฒนาโปรแกรมแยกปัญหาออกเป็นส่วนย่อยๆ ที่จัดการได้ง่ายขึ้น通过将创建过程和利用参数,开发者可以概括出可重复使用的流程。过程允许开发者调用已经测试过的现有代码,从而能够更快速、更有信心地编写程序。
**学习目标 AAP-3.A:**对于过程调用:
a. 编写语句以调用过程。[技能 3.B]
b. 确定过程调用的结果或效果。[技能 4.B]
-
AAP-3.A.1 过程是命名的一组编程指令,可能包含参数和返回值。
-
AAP-3.A.2 根据编程语言的不同,过程也被称为方法或函数等不同的名称。
-
AAP-3.A.3 参数是过程的输入变量。实参指定了过程被调用时参数的值。
-
AAP-3.A.4 过程调用会中断顺序执行的语句流,导致程序在执行完过程内的语句后才继续执行。一旦过程内的最后一条语句(或返回语句)执行完毕,控制流将返回到调用过程后的下一个位置。
-
AAP-3.A.5 考试参考表提供了
procName(arg1, arg2, ...)
作为调用
ข้อความ:
PROCEDURE procName(parameter1, parameter2, ...)
{
<block of statements>
}
บล็อก:
PROCEDURE procName parameter1, parameter2,...
block of statements
的一种方式,它接受零个或多个实参;arg1 被赋值给 parameter1,arg2 被赋值给 parameter2,以此类推。
-
AAP-3.A.6 考试参考表提供了过程
ข้อความ:
DISPLAY(expression)
บล็อก:
DISPLAY expression
用于显示 expression 的值,后跟一个空格。
-
AAP-3.A.7 考试参考表提供了
ข้อความ:
RETURN(expression)
บล็อก:
RETURN expression
语句,该语句用于将控制流返回到过程被调用的位置,并返回 expression 的值。
用于将“过程的值”赋值给 result,该值是通过调用
ข้อความ:
PROCEDURE procName(parameter1, parameter2, ...)
{
<block of statements>
RETURN(expression)
}
บล็อก:
PROCEDURE procName parameter1, parameter2,...
block of statements
RETURN expression