Seems the loop doesn't assign the result in the array.
Here the code example for Godot 3.2.
extends Node
func manually():
var vecs: = [Vector2(0.0, 0.0), Vector2(0.0, 0.0)]
vecs[0] += Vector2(0, 50) * rand_range(-1.0, 1.0)
vecs[1] += Vector2(0, 50) * rand_range(-1.0, 1.0)
return vecs
func loop():
var vecs: = [Vector2(0.0, 0.0), Vector2(0.0, 0.0)]
for i in vecs:
i += Vector2(0, 50) * rand_range(-1.0, 1.0)
return vecs
func _ready():
print(manually())
print(loop())
Did I miss something ?