[↑]
SmileBASIC4 Replica Reference
VAR
1. Define variables explicitly

VAR Variable[=Expression][,Variable[=Expression]...]
DIM Variable[=Expression][,Variable[=Expression]...]

・Either VAR or DIM can be used.
・Multiple variables can be defined simultaneously by separating them with commas.

Arguments

VariableNames

・Alphanumeric characters and underscores (_) can be used for variable names.
・You cannot use numbers at the beginning.

Expression

・The result of the expression becomes the initial value of the variable.
・If the expression is not specified, :Int type zero, #:Real type zero, $:empty string is set as the initial value by the type symbol (/#/$) at the end of the variable name.
・If the expression is not specified and the variable name has no type symbol, the default numeric type zero is set as the initial value.

Example

VAR A=0,B,C
DIM B$
2. Create an array and set it to a variable

VAR ArrayVariableName[[NumberOfElements[,NumberOfElements...]]]
DIM ArrayVariableName[[NumberOfElements[,NumberOfElements...]]]

・Either VAR or DIM can be used.

Arguments

ArrayVariableName

・If a type symbol (%/#/$) is added at the end of a variable name, an Int array, Real array, and string array are created respectively.
・If the type symbol is not specified, a default numeric type array is created.

NumberOfElements

・Specify the number of array elements to be secured with [].
・The number of elements can be created up to a 4D array by separating them with commas.
・If the number of elements is not specified, a 1D array with zero elements is created.

Example

VAR ATR[4]
VAR DX[5],DY[5],DZ[5]
DIM POS$[10,5]
DIM IMAGE[]
3. Create an array, set the value of the element in advance and set it to the variable

VAR ArrayVariableName[[NumberOfElements[,NumberOfElements...]]]=[Value1,Value2,...]
DIM ArrayVariableName[[NumberOfElements[,NumberOfElements...]]]=[Value1,Value2,...]

・Either VAR or DIM can be used.

Arguments

ArrayVariableName

・If a type symbol (%/#/$) is added at the end of a variable name, an Int array, Real array, and string array are created respectively.
・If the type symbol is not specified, a default numeric type array is created.

NumberOfElements

Specify the number of array elements to be secured with []

・The number of elements can be created up to a 4D array by separating them with commas.
・If the number of elements is not specified, a 1D array with zero elements is created.

Value

List of values to set as initial values for array elements

・If the number of elements is not specified, the number of values is a 1D array of the number of elements.

Example

VAR ATR[4]=[1,2,3,4]
DIM POS$[10,5]=["X","Y","Z","W"]
DIM IMAGE[]=[0,1,2,3,4]
About this site
Our site is an unofficial manual site of programming software "SmileBASIC" for NintendoSwitch™.
I acquire the content of the site from the official reference site of the SmileBoom Co.Ltd. that is the development and sales cause of the software in real time (a minimum period of 24 hours update) and display it. For automatic update, contents may become improper.
Please confirm the correct content in an official site.

June 3, 2020
by mim
OK
|