Groovy – Loops

  • Post author:
  • Post category:Groovy
  • Post comments:4 Comments
loops

So far Loops, we have seen statements that have been executed one after the other in a sequential manner. Additionally, statements are provided in Groovy to alter the flow of control in a program’s logic. They are then classified into the flow of control statements which we will see in detail.

S.No.Statements & Description
1While Statement
The while statement is executed by first evaluating the condition expression (a Boolean value), and if the result is true, then the statements in the while loop are executed.
2for Statement
The for statement is used to iterate through a set of values.
3for-in Statement
The for-in statement is used to iterate through a set of values.

Loop Control Statements

S.No.Statements & Description
1Break Statement
The break statement is used to alter the flow of control inside loops and switch statements.
2Continue Statement
The continue statement complements the break statement. Its use is restricted to while and for loops.

Next Topic:-Click Here

This Post Has 4 Comments

Leave a Reply