3 ms·
Can I index by 100s so there is plenty of room between them to add more indexes later?
by 83457 4y ago
Can I index by 100s so there is plenty of room between them to add more indexes later?
- Avshalom 4y agoIn Ada yes. It will work in Lua too but iterators aren't guaranteed to go in order if you do.
- Jtsummers 4y agoAda indexes have to be continuous ranges. So you'd need a type that was only every 100th number in order to use them as indexes, which I don't think can be made (I've never seen it, and looking it up I'm not seeing any way to make it). But you can select any arbitrary range as your array index, very handy as it neatly resolves the 0-/1-based issue: Choose the natural range for your situation.