GoFiler Legato Script Reference
Legato v 1.5b Application v 5.24b
|
Table of Contents | < < Previous | Next >> |
Chapter Four — Flow Control (continued)
Loops are extremely useful constructs for processing series of data in roughly the same way. For example, loops can be used to reorder items within an array or to iterate through a list and search for a particular entry. There are multiple types of loops which are described in the subsequent sections, and some loop structures lend themselves to different situations.
A loop contains a basic structure: iteration through a series of statements so long as a conditional expression evaluates to TRUE. The expression is tested for each iteration of the loop.
A loop will exit and execution will fall into the code below when:
1. The condition of the loop is satisfied (the expression resolves to FALSE)
2. A break statement is encountered.
3. A return statement is encountered.
4. An exit statement is encountered.
It is the programmer’s responsibility to ensure a loop reaches a condition where it will exit. If a script is stuck in a infinite loop, the application may hang and become unresponsive.
The break keyword exits a loop immediately. Execution resumes at the end of the brace belonging to the loop. This statement is useful to ending loop execution upon a certain condition, such as an error.
The continue keyword skips the remainder of the loop block statements and forces execution to resume from the first line following the initial for, while, or do loop statement. This statement is useful to skip processing the remainder of code in the loop upon a certain condition, such as passing a particular test case.
Table of Contents | < < Previous | Next >> |
© 2012-2024 Novaworks, LLC. All rights reserved worldwide. Unauthorized use, duplication or transmission prohibited by law. Portions of the software are protected by US Patents 10,095,672, 10,706,221 and 11,210,456. GoFiler™ and Legato™ are trademarks of Novaworks, LLC. EDGAR® is a federally registered trademark of the U.S. Securities and Exchange Commission. Novaworks is not affiliated with or approved by the U.S. Securities and Exchange Commission. All other trademarks are property of their respective owners. Use of the features specified in this language are subject to terms, conditions and limitations of the Software License Agreement.