Code: Select all
DIM array(100)
PROCtest(array())
END
DEF PROCtest(a())
IF DIM(a(),1) < 6 ENDPROC
PRINT DIM(a(),1)
PROCtest(a(0 TO DIM(a(),1) DIV 2))
PRINT DIM(a(),1)
ENDPROC
Code: Select all
100
50
25
12
6
6
12
25
50
100
Code: Select all
100
50
25
12
6
3
3
3
3
100
If it's important that it works 'as expected' you can achieve that by saving and restoring the slice dimensions yourself. In this example it's just the size that must be restored:
Code: Select all
DIM array(100)
PROCtest(array())
END
DEF PROCtest(a())
LOCAL size%
IF DIM(a(),1) < 6 ENDPROC
PRINT DIM(a(),1)
size% = !(PTR(a())+1) : REM Save size
PROCtest(a(0 TO DIM(a(),1) DIV 2))
!(PTR(a())+1) = size% : REM Restore size
PRINT DIM(a(),1)
ENDPROC