Flow of Control

  • Barclay K
  • Savage J
N/ACitations
Citations of this article
23Readers
Mendeley users who have this article in their library.
Get full text

Abstract

The execution of a program statement causes an action to be performed. The programs that have been developed execute one statement after another in a sequential manner. Because of this execution ordering of the statements, the program logic is described as sequential. Abstract actions can also be created with method definitions and then treat them as if they, likewise, were simple statements through their method calls. The statements that have been explored include the assignment, input/output, and method calls. Additionally, statements are provided in Groovy to alter the flow of control in a program's logic. They are then classified into one of three program flow of control structures: sequence, selection, and iteration. The fundamental iteration clause is the while statement. The while statement is executed by first evaluating the condition expression, and if the result is true, then the statements are executed. The entire process is repeated, starting once again with reevaluation of the condition. This loop continues until the condition evaluates to false. When the condition is false, the loop terminates. The program logic then continues with the statement immediately following the while statement. The group of statements is known as a compound statement or block. The break statement is used to alter the flow of control inside loops and switch statements. Finally, this chapter discusses continue statement. The continue statement complements the break statement. Its use is restricted to while and for loops.

Cite

CITATION STYLE

APA

Barclay, K., & Savage, J. (2007). Flow of Control. In Groovy Programming (pp. 67–83). Elsevier. https://doi.org/10.1016/b978-012372507-3/50010-1

Register to see more suggestions

Mendeley helps you to discover research relevant for your work.

Already have an account?

Save time finding and organizing research with Mendeley

Sign up for free