IMCScript variables
- 07 Nov 2024
- 1 Minute to read
- Print
- DarkLight
IMCScript variables
- Updated on 07 Nov 2024
- 1 Minute to read
- Print
- DarkLight
Article summary
Did you find this summary helpful?
Thank you for your feedback
Variables in IMCScript store values and functions that your script references or manipulates.
Variables characteristics and requirements
Variables are case sensitive.
Variables must begin with a-z, A-Z, _ (underscore), or $ (dollar sign), followed by 0-9, a-z, A-Z, _ (underscore), or $ (dollar sign).
Valid Not valid var1, _99, $1 9v, !a99, 1$
Literal variables
Literal variable types available in IMCScript are:
- Integer
- Double
- String
Examples
var count = 5; // Integer value
var percentage = 65.7; // Double value
var name = "Zilliant"; // String value
Non-literal variables
Non-literal variables available in IMCScript are:
- List—Returns the EBList data type.
- Map—Returns the EBMap data type.
Examples
var emptyList = List.create(); //List []
var list = List.create(3,4,5); //List [3,4,5]
var map = Map.create(); // Map {}
Working with List and Map
Initialize, access, and manipulate Array and Map as shown in the following example:
var emptyList = List.create(); // --> []
var list = List.create(3,4,6,7); // --> [3,4,6,7]
var map = Map.create(); // --> {}
list.deleteAt(2); // --> [3,4,7]
list.delete(7) ; // --> [3,4]
list.add(5); // --> [3,4,5]
map.add('A','Apple') ; // --> {'A':'Apple'}
map.add('B','Banana'); // --> {'A':'Apple','B':'Banana'}
map.delete('A'); // --> {'B':'Banana'}
map.add('C','Cherry'); // --> {'B':'Banana','C':'Cherry'}
var firstItem = list[0]; // --> 3
var keys = map.keys(); // --> ['B','C']
var fruitOfSummer = map['C']; // --> 'Cherry'
Was this article helpful?