Ambiguity of slice limits?

BlitzMax Forums/BlitzMax Programming/Ambiguity of slice limits?

The Forum Archive is locked. These are the original blitzbasic.com forums, kept so their posts can still be read and searched. No new topics, replies or edits can be made here. To join the conversation, head over to the Blitz3D+ forums.

The documentation says this:

a=a[..200]      'resize a[] to 200 elements


But but the 200 is supposed to be an index, right? so shouldn't that resize it to 201 elements? I've been trying to use slices myself, and it doesn't seem too easy because of this ambiguity. Reading this suggests that the EndIndex isn't actually included in the resulting array:

StringOrArray[StartIndex..EndIndex]

The length of the returned slice is always EndIndex - StartIndex elements long


Say for example you do myArray[0..10], then it should be 10 elements long (EndIndex-StartIndex), yet if element number 10 was included, then it would be 11 elements long. Arrrg!