I have an array named arr of type [Int8]:
var arr: [Int8] = []
Throughout the program I add items to the array using append and insert. However, when I try to remove an item using arr.removeIndexAt(x), it throws the error:
Playground execution failed: <EXPR>:144:13: error: immutable value of type '[Int8]'
only has mutating members named 'removeAtIndex'
arr.removeAtIndex(x)
Why is this happening? I tried recreating this in a playground:
var arr: [Int8] = []
arr.append(1)
arr.removeAtIndex(0)
and it works fine. Could someone please explain to me how I might fix this problem or remove an item another way? Any help wold be great. Thanks :)
for var x = start; arr[x] == 0; x--. This looks very messy to me. What exactly do you want to do inremoveExtraZeros()?