Quote:
Originally Posted by Switch
But sometimes I see someone's script and it doesnt have a ? in it, so clearly you don't ALWAYS have to use a ?. What are examples like that and what happens in them?
|
Are you talking about when there's a for loop with two "variables" seperated by a colon? Like "for (this.var : this.array)"
In this case, you
have to put an array on the right side of the colon. The for loop is then executed a number of times equal to the length of the array, and this.var is set to the corresponding value in the array each time.
So if this.array = {8, 20, 1, 6}, then the loop will be executed 4 times, and this.var will be set to 8 the first time, 20 the second time, 1 the third time and 6 the fourth time.
Of course, this.var can be any type of variable (you could just name it "i" as is standard in for loops), it doesn't have to be a this. variable.