| 12-24-2003, 03:13 AM | #1 |
the trigger is For each (Integer A) from 1 to 10, do (action) how exactly does this work? theres some like "for loop interger a" ? |
| 12-24-2003, 07:28 AM | #2 |
its used to repeat statements inside the "for" block so if u did For each (Integer A) from 1 to 10, do (Game - text message HI!) in the game u'd recieve HI! HI! HI! ...etc 10x integer A is used to determine how many times the "for" statement has gone through, such as For each (Integer A) from 1 to 10, do (Game - text message Integer A) in the game u'd recieve 1 2 3 ...etc to 10 |
| 12-24-2003, 07:36 AM | #3 |
Iffyn that wasn't clear: A for Loop does all the actions in it, and at the end, increments the For Integer, and if that integer is still equal to or less than the upper bound, it does the actions again: For Integer A = 1 to Integer A = 10 Do This It would start off with A = 1, and 'do this' Then it would do A = 2, and 'do this' until a = 10, and then it'd do it one more time and stop. This is often used when you want to do a number of actions, all depending on an incrementing value, generally in arrays. If I have an array with 100 pieces of data in it, and want to do the same action on each bit of data, I don't want to have to write 100 lines of code. Instead, I could simply do: For Integer A = 1 to Integer A = 100 Do Array (Index Integer A) Get it? |
