You're starting one too early. In a
for loop, the initialization (first part) comes before the increment (third part).
Code:
for (var i = 0; i < exampleListSize; ++i) {
exampleList[| i] = 0;
}
This is by far the most straight-forward way to do it generally for a list.
You could try having another list with 500 0's and then just
ds_list_copy() from that, or implementing a sparse array with unset entries treated as 0. But at your scale, I would recommend that you focus on being correct first, and being fast only after every other base is covered. Processing 500 entries won't be your project's unmaking, but doing it incorrectly could.
So many rookies these days want to be fast so ardently, they end up more wrong than they're fast. That just makes them look stupid faster. Don't be one of them.
Edit: Another issue is that you are declaring
i in instance scope, instead of local scope like what I did (notice the additional
var). It might not immediately matter in your current use case, but there are
common use cases where having iterating variables in instance scope is detrimental. Again, don't look at this from a performance lens, look at it from a correctness lens. There's always time for you to adjust once you're doing the right thing instead of the fast thing.