Skip to end of banner
Go to start of banner

For Loop

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Current »

We've encountered an issue exporting this macro. Please try exporting this page again later.

This is probably the second most common statement to use. It is helpful when working with fields that contain multiple values or when working with multiple issues (just for an example).

Example 1 - Finite number of loops

for(int x = 1; x <= 10; x+=1) {
    runnerLog(x);
}

Use this method when you are not looping through an array of values but some finite number.

Example 2 - Looping through an array

string [] fruit = "Apple|Apricot|Avocado|Banana|Blackberry|Blueberry|Cherry|Coconut";

for(string f in fruit) {
    runnerLog(f);
}

Use this method when looping through arrays and you don't need to know the index position.

Example 3 - Looping through an array with index

fruit = "Cranberry|Grape|Grapefruit|Kiwifruit|Lemon|Lime|Mango|Orange";

for(int x = 0; x < size(fruit); x++) {
    runnerLog(fruit[x]);
}

Sometimes you need to know what number (index) you are on while looping through an array.
In those cases you would use this method.

  • No labels