Warning

You're browsing the old v2.x documentation. This version is no longer maintained. Click here to go the v3.x documentation.

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
dim [2019/05/07 08:50] neilsdim [2020/01/25 08:43] neils
Line 3: Line 3:
 Syntax: Syntax:
  
-  dim <any variable>[<byte or int x_dim> [, <byte or int y_dim>]]+  dim <any variable>[<byte or int x_dim> [, <byte or int y_dim>]] [fast | @<address>]
  
-The ''DIM'' directive defines an array. See the [[arrays|Arrays]] page for more information.+The ''DIM'' directive defines a variable or an array __in compile time__. See the [[arrays|Arrays]] page for more information about arrays.
  
-''DIM'' can also be used to define a single variable without having to assign a value. For example:+Variables do not need to be predefined, but the ''DIM'' directive allows you to do so. For example you can use ''DIM'' to define fast variables:
  
-  dim x +  dim myFastVar fast 
-  rem -- x is now an uninitialized variable +   
-  print x +Read more about fast variables on the [[Variables|Variables]] page. 
-  rem -- the above will print an undefined number+ 
 +Since version 2.2, you can explicitly tell the compiler where in the memory the variable or array will reside, for example you can map the screen to an array as follows: 
 + 
 +  dim screen![1000] @ $0400 
 +