Bool data type
The logical or boolean data type of CRMScript is Bool.
Variables of this type can only have 2 values: true or false and are commonly used in comparisons and conditional statements.
Aside from testing the value, you can't do much except to convert it to a number or a string.
Note
You can create arrays of any data type to store more than one value at the same time like this: String[] s1;
. For a given array, all items must be of the same type. Read more about looping and accessing array items in the fundamentals section.
Constructors
Bool Bool(Bool value)
Pass a Bool
to copy into a new object.
Bool isWellFormed = true;
Bool isValid = Bool(isWellFormed);
Bool isCertified = Bool(false);
printLine("Valid: " + isValid.toString() + "\t Certified: " + isCertified.toString());
Integer toInteger()
Will return an integer representation of the boolean value.
False equals 0 and true equals 1.
Bool b = true;
printLine(b.toInteger().toString());
In this example, we 1st call toInteger()
to convert the Bool to an Integer, and then we call toString()
on the Integer to get a printable string. Notice the difference between this and the next example.
String toString()
toString()
is one of the most frequently used methods, typically when you are going to output something. It returns a string representation of a Bool.
Bool b = true;
printLine(b.toString());