20 Booleans

The two main boolean values are true and false. They stand for the logical values of the same name. They appear as values of the conditions in if-statements and while-loops. Booleans are also important as return values of filters (see Filters) such as IsFinite and IsBool. Note that it is a convention that the name of a function that returns true or false according to the outcome, starts with Is.

For technical reasons, also the value fail (see Fail) is regarded as a boolean.

  • IsBool( obj ) C

    tests whether obj is true, false or fail.

    gap> IsBool( true );  IsBool( false );  IsBool( 17 );
    true
    true
    false
    

    Sections

    1. Fail
    2. Comparisons of Booleans
    3. Operations for Booleans

    [Top] [Previous] [Up] [Next] [Index]

    GAP 4 manual
    February 2000