Greetings Monks,
I wish to write a small script for work, and I want to try to do it as correctly as possible the first time around. One of the things I'm trying to do is define a range of numbers 1..X with a variable that will cycle through that list in a for loop. For example, it will count from 1 to 4, but then once it gets incremented again ($i++ in a loop for example), it goes straight back to 1 and not 5.
I thought about doing something like:
if ( $i > 4 ) { $i = 1; }
In reply to "Round Robin" variable range? by Salamihawk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |