3 ms·
You can insert items before the start
by humbugtheman 3y ago
You can insert items before the start
- layer8 3y agoSo it’s not invariably true that arrays start at -1? They only start at -1 after an array literal assignment? You need to update the language description! ;)
- barnabee 3y agoPerhaps they start at -1 and proceed in both directions
- cdcarter 3y agoconst var scores = [3, 2, 5]! scores[0.5] = 4 print(scores) //[3, 2, 4, 5]! scores[-2] = 10 print(scores) //[10, 3, 2, 4, 5] print(scores[-1]) // 10 is how I interpret the spec, but I did not run this through the reference compiler yet.