Hi all,
I have a small question about “best practices”.
I’m making a “preset” that refers to some indexes of an array that will be loaded dynamically.
I can reserve a hundred slots in the array easily: ~a = Array.fill(100, {0});
But in the “loading section” of the code, I am adding to ~a: ~a = ~a.add(Array.fill(100, {1}));
The problem here is that I now have a 200-slot array with 100 dummy values.
I could simply overwrite the whole array, by repeating the initial line - but if I don’t add a conditional statement that says “after the first time overwriting the ~a array, switch to “adding” to the ~a array.” I’m wondering if there is a more concise approach, though.
Thanks!