ArrDimension

Creates an array.

Syntax:

ArrDimension( dim1 [, dim2 [, dim3 [, dim4 [, dim5 ] ] ] ] )

Parameters:

(i) dimension: "dim1"- "dim5" an array of up to 5 dimensions.

Returns:

(a)  array: array that was created.

 

ArrDimension takes a variable number of parameters. The ArrDimension function takes at least one parameter. Optionally, you can specify up to five.

For example:


1-dimension array: array1 = ArrDimension(10)
2-dimension array: array2 = ArrDimension(10, 10)
3-dimension array: array3 = ArrDimension(10, 10, 10)
4-dimension array: array4 = ArrDimension(10, 10, 10, 10)
5-dimension array: array5 = ArrDimension(10, 10, 10, 10, 10)

ArrDimension(10) creates a 1-dimension array with a size of 10 (10 elements). Since array subscripts are 0-based, the first element is arrayvar[0] and the last element is arrayvar[9]. An array can theoretically contain up To 200,000,000 elements In total. Of course this will be further limited By your available system memory. You can not create embedded arrays (i.e., an array within an array). You can use the Drop command To free an array. This will also Drop any COM/OLE object handles within the array, as well as any WIL STRING variables. It will NOT close any file handles or binary buffers.

 

Example:
totalfortunes=20
fortune=ArrDimension(totalfortunes)
fortune[0] = "All your hard work will soon pay off."
fortune[1] = "Winbatch will save you time."
fortune[2] = "Your present plans are going to succeed."
fortune[3] = "You will live a long time."
fortune[4] = "One learns when teaching others."
fortune[5] = "Success means competition."
fortune[6] = "Your example will inspire others."
fortune[7] = "One must be available, alert, active, and adaptable."
fortune[8] = "If you have many best friends, you have no friends."
fortune[9] = "Mountains can move, but not your character."
fortune[10]= "You are a great coder."
fortune[11]= "Concern yourself about others more than yourself."
fortune[12]= "Time is the wisest counsellor."
fortune[13]= "What you desire is always possible. It will come to you."
fortune[14]= "You are known to be quick in action and decisive."
fortune[15]= "You are open-minded and quick to make new friends."
fortune[16]= "A good laugh and a good cry both cleanse the mind."
fortune[17]= "Failure is the mother of success."
fortune[18]= "Now is the time to try something new."
fortune[19]= "An old pot is the best around the kitchen."

:Start ;Initialize the dialog BoxesUp("200,200,800,800", @zoomed) BoxCaption(1, "Pick a Fortune cookie") BoxColor(1,"201,200,150",0) BoxDrawRect(1,"0,0,1000,1000",2) dice=0 retry=0
ONCANCEL="Goto Shutdown"
dice=AskLine("Pick a Fortune cookie","Enter a number between 1 and %totalfortunes%",1,0) If (dice >= 1 && dice <= totalfortunes) ;Display the fortune BoxCaption(1, "Your Fortune cookie says") BoxTextColor(1, "128,0,128") BoxTextFont(1, "Book Antiqua", 50, 10, 16) BoxDrawText(1, "0,200,1000,800", fortune[dice-1], @true, 1) TimeDelay(2) Else Message("Your Fortune cookie says","Unfortunately...%@CRLF%You picked a wrong number.") EndIf
retry=AskYesNo("Pick a Fortune cookie","Do you want to try again") If retry == 1 Then Goto start Exit
:CANCEL IntControl(72, 2, 0, "", 0);Sets cancel processing %ONCANCEL% Return
:Shutdown retry=AskYesNo("Pick a Fortune cookie","Do you really want to EXIT?") If retry == 1 Then Exit Goto start
See Also:

Arrays, ArrayFileGet, ArrayFileGetCsv, ArrayFilePut, ArrayFilePutCsv, ArrayFromStr, ArrayInsertArrayItemize, Arrayize, ArrayLocate, ArrayRedim, ArrayRemove, ArrayReverse, ArraySort, ArraySwapElements, ArrayToStr, ArrDimension, ArrInfo, ArrInitalize, Drop