
reference.language.for-each.html Maven / Gradle / Ivy
For each
For each statements
A for each statement is a way to execute a set of statements for each item in a collection.
A simple for each statement has the form for each item in collection
followed by a list of statements which will be executed for each item in the collection,
where item
is a variable name and collection
is a collection.
If item
already exists, its type must be compatible with the item type of the collection.
Optionally, a for each statement can populate an index variable.
Breaking the iteration
It is sometimes useful to break the iteration before reaching the end of the collection. This is achieved using the break
statement.
© 2015 - 2025 Weber Informatics LLC | Privacy Policy