|
|
|
|
TechNotes
MioScript Reference
Products
|
|
TechNote MioScript: Variables and Data Types | Language: MioScript
|
| | A MioScript variable can contain a strings, numbers, Boolean values or arrays.
To declare a new empty variable:
To retrieve the value stored in a variable:
Functions to work with variables: var...
|
Strings| |
A string is enclosed in quotes:
Code Sample:
event.load
&myVar = "hello"
alert(&myVar)
app.close()
event.end
|
To concatenate (join) strings with a value stored in a variable, proceed as follow:
&myName="MioMan"
&result = "Hello, "&mioMan
|
To concatenate the values of two variables, use the double quote (empty string):
&myString="Hellon "
&myName="MioMan"
&result = &myString""&mioMan
|
|
Numbers| |
Floating points numbers are not supported by MioScript.
MioScript is supposed to work in back-office with the computer and the windows API.
As JavaScript is used to work at the end-user level (interface and data manipulation) the floating points operations are done with JavaScript.
Mathematical calculations:
&myNumber = 100
&result = 10 + (255 * &myNumber)
|
The function num.compute make it possible to concatenate calculations with strings:
&myNumber = 100
&result = "The result is: "num.compute(&myNumber / 2)
|
Mathematical Operators
+ Addition
- Substraction
* Multiplication
/ Division
|
Boolean Values| |
Boolean values can be stored in any variable.
The keyword true is egual to 1.
The keyword false is egual to 0.
event.load
&IamHappy = true
alert(&IamHappy)
app.close()
event.end |
A boolean value can be used in a calculation formula.
|
Arrays| |
A variable can be used to store an array of values.
To initialize a new array:
To store values in an array:
&myArray[] = null
&myArray[0] = "firstValue"
&myArray[1] = "secondValue"
|
We could also declare the array as follow:
&myArray[] = "firstValue^^secondValue"
|
To retreive the value of an item in the array:
&myArray[] = "firstValue^^secondValue"
alert(&myArray[1])
|
|
|
|
|