Hello,
Arrays always start at 0. Why do I also need FirstIndex?
I’d rather have FirstObject and LastObject available.
What is the difference if it returns array(0) ?
i think .FirstIndex for consistent.
I’d rather have FirstObject and LastObject available.
if you speak about objects its better to use for each
Arrays always start at 0
some languages use
0 to count-1
others
1 to count
We have MyArray.Pop to get the last item and remove it in the same instruction. I miss MyArray.Shift to get and remove the first item.
On first glance I missed the “f” in shift, but it still made perfect sense to me
Some say your humor is a bit dark sometimes.
I don’t understand as there is the f in my post. Or a moderator edited my comment?
That’s a very polite way of saying I have a childish sense of humor.
You did nothing wrong, it was simply my mind mis-reading array.shift
as an alternative (and rude) word for feces, but not seeing anything wrong with it and actually accepting this as a means for extracting the first item and then “dumping” it from an array.
I use this technique a lot with many asynchronous callbacks from Apple’s API, but I’ve never needed to use array.pop
.
Perhaps I should log a feedback request for array.shift
, with an f
in the name.
I add a feature request <https://xojo.com/issue/67306> .
What I do is myArray.AddAt(0)
, instead of Add
, so I can myArray.Pop