Arrays

Map array

points.assign(points.map(func(point : Vector2i) -> Vector2i:
    return point + Vector2i(-1, 0)
    ))
  • Map:

    • Performs mapping and returns the mapping result.

    • Return is always of type Array .

  • Assign:

    • Takes all elements from an array and puts them into itself, converting types.

      • In this case, converts the return of map  to Array[Vector2i] , since points : Array[Vector2i] .

    • Assign seems to clear the current array, but it's strange.