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.

Full Text
Paper version not known

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.