// Moves all transform children 10 units upwards!
for (var child : Transform in transform) {
child.Translate(0, 1, 0);
}
I came across this code in the scripting overview, and I was wondering what this does exactly. The variable is of type Transform, but what is the "in transform" doing?
As simply as I can put it - Transform is a type which can be enumerated over (kinda like looped over)
Any type which can be enumerated over lets you use the for(blah in enumerator) syntax - another example would be:
for (var str : String in stringArray){}
Transform (Or any class which is enumerable) has to define how it needs to be iterated through, in the case of Transform, it loops through its children