Array Specifics #422
Answered
by
mybearworld
GoldenStack
asked this question in
Q&A
-
Do float indices make arrays act similar to maps (where you can provide any key) or do they add the element in the middle and shift all the others over? const var scores = [3, 2, 5]!
scores[0.5] = 4!
print(scores)! //[3, 2, 4, 5] Are the elements of this array indexed as |
Beta Was this translation helpful? Give feedback.
Answered by
mybearworld
Oct 1, 2023
Replies: 1 comment
-
Floats are used as indices. So, this would be |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
GoldenStack
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Floats are used as indices. So, this would be
[-1, 0, 0.5, 1]
.