Statement | Description |
---|---|
if | Classic, if/else statement, e.g. if ((x * 2) == 5) { y = 1; } else { y = 2; } |
for | Loop through items of an Array, Collection, Map, Iterator or Enumeration, e.g. for (let item : list) { x = x + item; } Where list is a context variable pointing to any iterable structure. The following syntax using a context variable is also supported: for (item : list) { x = x + item; } Note that the loop variable item is accessible after loop evaluation Finally, the conventional syntax using a local variable, initial value, loop condition and loop step is supported. for (let i = 0; i < size(list); ++i) { x = x + list[i]; } Where list is a local variable pointing to an array-like structure. The JEXL 1.1 syntax using foreach(item in list) is now unsupported. |
while | Loop until a condition is satisfied, e.g. while (x < 10) { x = x + 2; } |
do/while | Loop until a condition is satisfied, e.g. do { x = x + 2; } while (x < 10) |
continue | Within loops (do/while/for), allows to skip to the next iteration. |
break | Allows to break from a loop (do/while/for) unconditionally. |