Avisaro Online Documentation - Wiki
Impressum Kontakt Sitemap

DIM

Description

DIM is the standard BASIC keyword to create arrays. Arrays are an ordered set of one ore more variables of the same type. In the Avisaro Scripting Language, the default element type is byte, which is an unsigned 8 bit value. Thus, a DIM instruction without extension creates byte arrays. If the DIM statement is extended with AS INTEGER, an array is created which elements are 32 bit signed integers.

Example

The following example creates one byte- and one integer array, sets some value and prints them out.

outmode -2
dim a(10)
dim b(10) as integer 
let a(0) = 255 
let a(1) = 256 
let b(0) = 255 
let b(1) = 256 
print a(0) 
print a(1) 
print b(0) 
print b(1

Because a is a byte array, the instruction let a(1) = 256 wraps around to zero. This differs from let b(1) = 256, since b is a 32 bit signed integer array that can hold much bigger values.

Remarks

Please note that memory is limited when using arrays. See also the MEMCFG command.