not

Usage

-- Lingo syntax 
not logicalExpression 
 
// JavaScript syntax 
! logicalExpression

Description

Operator; performs a logical negation on a logical expression. This is the equivalent of making a TRUE value FALSE, and making a FALSE value TRUE. It is useful when testing to see if a certain known condition is not the case.

This logical operator has a precedence level of 5.

Example

This statement determines whether 1 is not less than 2:

-- Lingo syntax 
put(not (1 < 2)) 
 
// JavaScript syntax 
put(!(1 < 2));

Because 1 is less than 2, the result is 0, which indicates that the expression is FALSE.

This statement determines whether 1 is not greater than 2:

-- Lingo syntax 
put(not (1 > 2)) 
 
// JavaScript syntax 
put(!(1 > 2));

Because 1 is not greater than 2, the result is 1, which indicates that the expression is TRUE.

This handler sets the checkMark menu item property for Bold in the Style menu to the opposite of its current setting:

-- Lingo syntax 
on resetMenuItem 
    menu("Style").menuItem("Bold").checkMark =  
    not (menu("Style").menuItem("Bold").checkMark) 
end resetMenuItem 
 
// JavaScript syntax 
function resetMenuItem() { 
    menu("Style").menuItem("Bold").checkMark =  
    !(menu("Style").menuItem("Bold").checkMark) 
}

See also

and, or