Array v1 to v2
Posted: 27 Mar 2024, 09:32
Edit: Going to use Map(). Seems to do what I need.
So, I'm finally trying to learn the v2 syntax by converting one of my v1 scripts.
Below is an example of an array, the way I've formatted it in v1:
This code is giving me an error in v2, so I would assume this has changed.
If I require a specific value to be assigned to a specific index within the array, what is the new way to achieve this?
I think the code I have below will work -- but I would like to know if this is the recommended way going forward, or are there still alternative ways to do this like the code above?
Or maybe this is the new way?
So, I'm finally trying to learn the v2 syntax by converting one of my v1 scripts.
Below is an example of an array, the way I've formatted it in v1:
Code: Select all
MyArray := []
MyArray[1] := "MyText1"
MyArray[2] := "MyText2"
MyArray[3] := "MyText3"
If I require a specific value to be assigned to a specific index within the array, what is the new way to achieve this?
I think the code I have below will work -- but I would like to know if this is the recommended way going forward, or are there still alternative ways to do this like the code above?
Code: Select all
MyArray := []
MyArray.InsertAt(1, "MyText1")
MyArray.InsertAt(2, "MyText2")
MyArray.InsertAt(3, "MyText3")
Code: Select all
MyArr := Map()
MyArr[1] := "MyText1"
MyArr[2] := "MyText2"
MyArr[3] := "MyText3"