Closed SodaPopinski closed 5 months ago
Yes this is kind of missing.
The reason why I was somewhat careful about this in the beginning was that a const array
should be indeed const
i.e. readonly. So something like array.add_time
should only be possible for non-const arrays.
... and then I forgot about it ;)
I will extend the API/language like this:
array1 + array2 // Always creates a new, concatenated array (array1, array2 remains unchanged)
array1 + element // Always creates a new array with an additional element (array1 remains unchanged)
array1 += array
array1 += element // Both only possible if array is non-const (i.e. `let` or in a Cell)
This should work now in 0.3.5 or 0.4.0.1
Closing this for now. Just reopen if the problem pops up again
I can't figure out how to add an item to an already existing array. I've tried my_array.add(item), my_array.Add(item), my_array.append(item). I always got an error that the array doesn't have that method.
I've also tried creating a second array with the item, and tried adding the two arrays together, and got an error that int[] can't be added to int[].
Am I missing something, or is this function not implemented?