&and, &or, ¬, &equal, &sequal - Logical macro operators
&and log1 log2
&or log1 log2
¬ log
&equal num1 num2
&great num1 num2
&less num1 num2
The logical testing operators perform comparison tests, returning a boolean value of TRUE (1) or FALSE (0).
The functions may all be abbreviated to their three letter abbreviation (i.e. &great may be expressed as &gre). In all cases the first argument is completely evaluated before the second argument. Logical operators include:-
&and log1 log2
&or log1 log2
¬ log
The numerical logical functions operate with integer arguments:
&equal num1 num2
great num1 num2
&less num1 num2
Evaluation of the logical operators are left to right, the leftmost argument is fully evaluated before the next argument. The operator ordering is prefix notation (see &add(4) for an example of prefix ordering).
Test for integers in the range greater than 12:
!if &great %i 12 ...
Test for integers in the range 8-12, inclusive
!if &and &great 7 &less 13 ...
MicroEmacs always evaluates all arguments operators BEFORE the result is obtained, this differs from most programming languages. Consider the following example:
!if &and &bmod "edit" &iseq @mc1 "Save buffer first [y/n]? " "nNyY" "y" save-buffer !endif
This would not not work as the user may expect, the user would be prompted to save every time regardless of whether the buffer has been changed. Instead the following should be used:
!if &bmod "edit" !if &iseq @mc1 "Save buffer first [y/n]? " "nNyY" "y" save-buffer !endif !endif
(c) Copyright JASSPA 1999
Last Modified: 1999/01/05
Generated On: 1999/12/01