Error Array

BlitzMax Forums/BlitzMax Beginners Area/Error Array

Yue(Posted 2015) [#1]
Hi, this does not work for me here, I'm doing wrong?

I returned an error.

Local numeros:Int[10]


For n:Int = 0 To  10

    numeros[n] = n
    Print numeros[n]

Next 





Chalky(Posted 2015) [#2]
Local numeros:Int[11]


For n:Int = 0 To  10

    numeros[n] = n
    Print numeros[n]

Next 

0 to 10 = 11 elements (you've only defined 10: i.e. 0 to 9)


Yue(Posted 2015) [#3]
Ok, Thanks You. :)

Local numeros:Int[10]


For n:Int = 0 Until   10

    numeros[n] = n
    Print numeros[n]

Next 





Brucey(Posted 2015) [#4]
If you are using 0-based indexing, "Until" seems to make more sense.

This way you can do ... Until array.length... as opposed to ... To array.length - 1


Yue(Posted 2015) [#5]
Hi, thanks for the help, my question is for serving the arryas method, called Dimensions ().