Difference between revisions of "Core.Terms.ToBoolean"

From emotive
Jump to navigation Jump to search
Line 3: Line 3:
 
{{ClassificationActivity | ToBoolean | To convert an expression to a Boolean | [[Term]] | [[Core|OTX Core library]] | [[Conversion terms]] | - | - }}
 
{{ClassificationActivity | ToBoolean | To convert an expression to a Boolean | [[Term]] | [[Core|OTX Core library]] | [[Conversion terms]] | - | - }}
  
== Pseudo-Code Syntax ==
+
== OTL Syntax ==
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
Value = ToBoolean(Term)
+
BooleanTerm = Conversion.ToBoolean(Term);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Line 33: Line 33:
 
== Examples ==
 
== Examples ==
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
MyBooleanValue = ToBoolean(0)
+
Boolean Boolean1;
MyBooleanValue = ToBoolean("true")
+
Boolean1 = Conversion.ToBoolean(0);
MyBooleanValue = ToBoolean("false")
+
Boolean Boolean2;
 +
Boolean2 = ToBoolean("true");
 +
Boolean Boolean3;
 +
Boolean3 = ToBoolean("false");
 
</syntaxhighlight>
 
</syntaxhighlight>
  

Revision as of 12:31, 3 February 2015

Classification

Name ToBoolean
Short Description To convert an expression to a Boolean
Class Term
Extension OTX Core library
Group Conversion terms
Exceptions -
Checker Rules -
Standard Compliant Yes

OTL Syntax

BooleanTerm = Conversion.ToBoolean(Term);

Description

Term to the convert an expression to a Boolean.

Return Value

The Term returns the value, see table below.

Icons Note.png In OTX, Terms are categorized according to its return data type!
Data Type Description
Boolean Return value of the appropriate type.

Rules

  • Boolean
    Returns a copy of the value
  • Integer
    If 0, return false , otherwise true
  • Float
    If 0.0, return false , otherwise true
  • ByteField
    If empty, return false , otherwise true
  • String
    If the value of the string "True", and not taken into account - insensitive will return true , otherwise false

Properties

Name Data Type Class Default Cardinality Description
Term - Term - [1] The expression to be converted. Rules, see description.

Examples

Boolean Boolean1;
Boolean1 = Conversion.ToBoolean(0);
Boolean Boolean2;
Boolean2 = ToBoolean("true");
Boolean Boolean3;
Boolean3 = ToBoolean("false");

See also

ToInteger
ToFloat
ToByteField
ToString