OScript API/Built-in Package Index

Class: Boolean

A Boolean represents a two-state value, either TRUE or FALSE. Boolean values can be obtained by:

  • declaring a Boolean variable (default value of FALSE)
  • using a Boolean constant (for example, TRUE or FALSE)
  • evaluating a Boolean expression (for example, ( recordNumber >= 100 ) )
  • executing a function that returns a Boolean value (for example, the function File.Close()

Boolean expressions are created by using relational or logical operators to form an expression whose result is either TRUE or FALSE. For more information about relational and logical operators, see the Operators section of the Oscript Language Reference Manual.

For example, if these variables are declared:

    String dataLine
    Integer count
    Real x, y
    Boolean libraryRecords, newRecord

the following are all valid Boolean expressions:

    dataLine != ""
    count <= 5000
    y < x
    libraryRecord && newRecord

Booleans are often used as test criteria in looping or conditional structures. For example:

    Boolean done
    while !done
        textLine = File.Read( myFile )
        allLines += ( textLine + Str.EOL() )
        done = File.EOF( myFile )
    end

In this example, the Boolean expression !done is evaluated and then script execution branches or continues depending on whether the Boolean expression evaluates to TRUE or FALSE.

 Copyright © 2021 OpenText Corporation. All rights reserved.