Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

Hull and Outfitting

BOOLEAN Expressions and if Statements

  • Last UpdatedNov 10, 2025
  • 2 minute read

New expressions based on the operators such as EQ and GT give a BOOLEAN result that can be used directly in a PML2 if test:

if (!NewValue - 1 GT 0) then

The expression can be a simple variable provided it is a BOOLEAN type variable:

 !Success = !NewValue GT 0

if (!Success) then

The expression could be a user-defined PML Function provided it returns a BOOLEAN result:

if (!!MyFunction() ) then

Note: The BOOLEAN constants TRUE, FALSE, YES and NO and their single-letter abbreviations not enclosed in quotes return BOOLEAN results and so can be used directly in expressions. For example:

Code

Result Type

if ( TRUE )

if ( FALSE )

BOOLEAN

if ( T ) 

if ( F ) 

BOOLEAN

if ( YES )

if ( NO )

BOOLEAN

if ( Y )

BOOLEAN

The following do not return BOOLEAN values and are therefore invalid:

Code

Result Type

if ( 1 )

if ( 0 )

REAL

if ( ‘TRUE’ )

if ( ‘FALSE’ )

STRING

if ( ‘T’ )

if ( ‘F’ )

STRING

Variable = 1

if ($Variable)

REAL

For upward compatibility with PML1, STRING variables set to ‘TRUE’, ‘FALSE’, ‘YES’ or ‘NO’ or their single-letter abbreviations can be used in an if-test as long as they are evaluated with a preceding $. For example:

Code

Result Type

Variable = ‘TRUE’

if ($Variable)

STRING

There is a built-in PML Method and a function for converting a value to BOOLEAN:

 !MyString = ‘TRUE’

if (!MyString.Boolean() ) then . . .

The Boolean conversion is as follows:

Code

Result

REAL zero

FALSE

$* All other positive and negative REAL values

TRUE

STRING ‘FALSE,  ‘F’, ‘NO’ and ‘N’

FALSE

STRING ‘false,  ‘f’, ‘no’ and ‘n’  

FALSE

STRING ‘TRUE’,  ‘T’, ‘YES’ AND ‘Y’ 

TRUE

STRING ‘true’,  ‘t’, ‘yes’ and ‘y’ 

TRUE

Related Links
TitleResults for “How to create a CRG?”Also Available in