|
@@ -1143,6 +1143,24 @@ in the loop variable.
|
|
|
for i in 2.2:
|
|
|
statement # Similar to range(ceil(2.2)).
|
|
|
|
|
|
+If you want to assign values on an array as it is being iterated through, it
|
|
|
+is best to use ``for i in array.size()``.
|
|
|
+
|
|
|
+::
|
|
|
+ for i in array.size():
|
|
|
+ array[i] = "Hello World"
|
|
|
+
|
|
|
+
|
|
|
+The loop variable is local to the for-loop and assigning to it will not change
|
|
|
+the value on the array. Objects passed by reference (such as nodes) can still
|
|
|
+be manipulated by calling methods on the loop variable.
|
|
|
+
|
|
|
+::
|
|
|
+ for string in string_array:
|
|
|
+ string = "Hello World" # This has no effect
|
|
|
+
|
|
|
+ for node in node_array:
|
|
|
+ node.add_to_group("Cool_Group") # This has an effect
|
|
|
match
|
|
|
^^^^^
|
|
|
|