messiah:script supports all of the logic operators found in C and C++. They are:

==

equals

!=

does not equal

<

is less than

>

is greater than

<=

is less then or equal to

>=

is greater than or equal to

&&

this is true AND that is true

||

this is true OR that is true

!

not

These symbols are used almost exclusively in control structure's conditions.  For example you will perform some operation if 'a' is less than 'b' and greater then 'c':

if( (a < b) && (a > c) )

When we're dealing with logic we are dealing with values of 'true' and 'false' only.  In this case we are testing the inequality of (a<b) and (a>c), each of those expressions will evaluate to a boolean 'true' or 'false' value.  Then the results of those expressions are tested against && which will itself evaluate to 'true' if and only if both of it's operands are 'true'.

C/C++ users: messiah:script uses the same order of precedence as C and C++ so the above parentheses are used for clarity only. if( a < b && a > c ) will work as expected.

Below are examples of each of the logic operators at work:

// execute statement only if a equals 5
if( a == 5)

    statement;

// execute statement only if a does not equal 5
if( a != 5 )

    statement;

// loop as long as a is less than 20
while( a < 20 )

    statement;

// loop as long as a is greater than 20
while( a > 20 )

    statement;

// loop as long as a is less than or equal to 20
while( a <= 20 )

    statement;

// loop as long as a is greater than or equal to 20
while( a >= 20 )
    statement;

// execute if both functions return non-zero
if( func1() && func2() )
    statement;

// execute if either function returns non-zero
if( func1() || func2() )

    statement;

// execute if neither function returns non-zero
if( !func1() && !func2() )

    statement;

// loop until func returns non-zero
while( !func() )

    statement;

Note: Don't confuse the logical 'and', 'or' & 'not' operators with their bit-wise counterparts.  messiah:script supports all bit-wise operations defined in C and C++.  For more information on bit-wise operators and their uses see General Info->Develop->C Language Ref.->Bit Fields.

Converted from CHM to HTML with chm2web Pro 2.82 (unicode)