brainfade with slicing

BlitzMax Forums/BlitzMax Beginners Area/brainfade with slicing

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Hi, I'm not getting the expected results with slicing:

Strict
Local test[4]
test[0] = 10
test[1] = 20
test[2] = 30
test[3] = 40

Print Len(test)

test = test[1..2]

Print Len(test)


I'm expecting to see an array of length 2 but I get 1!

If I do test=test[2..2] I'd expect a single array slot but I get a length of 0, weird.

What am I doing wrong please?

Oh, also, is slicing 1-based? I assumed so as I thought 0..0 was a was to clear an array (instead of array=null)