Data types
In simple terms, if a variable is used to refer to stored data, the data type is used to refer to the type of data.
For a computer application, a number, a letter, and a date are all the same, a piece of information, or in other words, data. But different types of data cannot always react with each other. For example, it is illogical to multiply a number with a date. Since, in programming, there is often a need to perform operations between different types of data, there arises a need to differentiate between the types. And this is exactly the purpose of data types.
Data types define what type the given data is, and as a result, how the user can use the data.
The following data types are supported in Facilio Scripting.
#
StringThe text, datatype represents a sequence of characters. These characters can be text characters, special characters, numeric characters, or other valid input, and must be enclosed in double quotes.
name = "David";
#
NumberThe Number datatype represents integer values. Number datatype can be used to perform operations with decimal values, in which case the end result becomes a decimal datatype.
age = 21;
#
BooleanThe Boolean data type is a data type that has one of two possible values (usually denoted true and false) which is intended to represent the two truth values of logic and Boolean algebra.
isactive = true;
#
MapA map data type represents an unordered collection of key-value pair elements. ... A map element is a key and value pair that maps one thing to another.
asset = {};asset.name= "HVAC";asset.category= "Chiller";asset.warrantyExpiryTime="July 21, 2021";
#
ListList is a data-type which can hold a collection of values. And each value present in the list is called an element. A list can contain elements of different types say number, text, date etc. grouped together. So you can store a number, a text, a date etc as different elements in the same list. The elements in a list are marked using an index value.
colors = ["Red", "Yellow", "Green", "Orange"];