Data Type Boolean

From emotive
Jump to: navigation, search

Classification

Name Boolean
Short Description Boolean value of true or false
Class Simple Data Type
Base Data Type SimpleType
Default Value FALSE
Provide a Literal Yes
SpecifiedBy ISO 13209-2
Standard Compliant Yes

Description

OTX Boolean values have a value space of {"true", "false", "1", "0"}. Even though "1" and "0" are contained in the value space, treating Boolean values like numeric values directly is not allowed by OTX. OTX adheres to the W3C definition of the xsd:boolean data type.

Core Conversion

The following table shows the rules for conversion to another data type:

Conversion Result Sample
ToBoolean Returns the copy of the value Boolean b = ToBoolean(true); // Returns true
ToInteger Returns 1 if the value is true, otherwise 0 Integer i = ToInteger(true); // Returns 1
ToFloat Returns 1.0 if the value is true, otherwise 0.0 Float f = ToFloat(true); // Returns 1.0
ToString Returns "true" if the value is true, otherwise "false" String s = ToString(true); // Returns "true"
ToByteField Returns 0x01 if the value is true, otherwise 0x00 ByteField bf = ToByteField(true); // Returns 01

Sample

Boolean BooleanVariable = false;