User Tools

Site Tools


en:dim

This is an old revision of the document!


Dim (Statement)

Format

Create a One Dimensional Array

dim variable ( posint_expr )
dim variable ( posint_expr ) fill expr
dim variable [ posint_expr ]
dim variable [ posint_expr ] fill expr

Create a Two Dimensional Array

dim variable ( row , column )
dim variable ( row , column ) fill expr
dim variable [ row , column ]
dim variable [ row , column ] fill expr

Use a List to Create and Fill an Array

dim variable = { list ... }
dim variable = { { list ... }, { list ... } ... }

Copy One Array to Another

dim variable = variable === Fill an Existing Array With a Single Value ==== dim variable fill expr ==== Description ==== Returns a newly created single dimensional array of length integer or a 2 dimensional array that can be addressed by row and column.
The first element of an array has an index of 0 (zero). Indexes range from 0 to length-1. The dim statement can also be used to create a new array that is a duplicate of another array. The form “DIM var = var” does this by dimensioning a new array in memory and copying all of the data from the original array. ==== Example ==== <code> dim z = {1, 2, 3, 4, 5} print z[0] + “ ” + z[4] </code> will print <code> 1 5 </code> ==== Example Two ==== <code> dim c(4) c[0] = “cow” c[1] = “brown” c[2] = “how” c[3] = “now” print c[2] + “ ” + c[3] + “ ”; print c[1] + “ ” + c[0] + “?” </code> will print <code> how now brown cow? </code> ==== See Also ====

==== History ==== |1.99.99.55|Cleaned up documentation and added array copy.|

en/dim.1470672241.txt.gz · Last modified: 2020/02/28 10:46 (external edit)