Diotima wrote: > Is there a way to express "and" & "or" in an IF statment with macros? There is! Remember that the three type of "if" condintionals are: IF <...> (if the comparison is true, then do this) ELSE IF (if the first comparison is not true, then try this comparison) <...> (if the comparison is true, then do this) ELSE (if all of the comparisons are false, then do this instead) <...> END IF (very important; tell the macro to stop testing comparisons!) The OR part is easy: it's simply the ELSE IF statement. They're synonymous! While we're on the subject, the ELSE comparison can be thought of as the NOT binary comparison. To check for two conditions that are true, simply nest the comparisons: // A simple macro to check if flag_one is set AND if flag_two is set. // // This macro assumes that somewhere earlier in our macro that // there was a SETGLOBAL to our two global variables, // "flag_one" and "flag_two". The two settings are "0" (clear) // and "anything that isn't 0" (set) (this routine is not provided). test_the_flags { IF flag_one =< 1 IF flag_two =< 1 message "Both flags are set!" ELSE message "Only flag one is set." END IF ELSE IF flag_two =< 1 message "Only flag two is set." ELSE message "None of the flags are set." END IF } Here's the annotated version of the same macro: test_the_flags { // First comparison: check flag_one to see if it has been set. // By set, we're looking for any positive, non-zero number; if it's zero, then the flag is clear. IF flag_one =< 1 // If flag_one is set, then we're ready to go to the next instruction, // which is another IF comparison. Yes, this is legal, and you may have // as many IF...ELSE IF...ELSE...END IF nested within each other as you // care to have! // // Okay! On to flag_two! IF flag_two =< 1 // If flag-two is set as well, then we go to the next instruction. // The only way to get to this next instruction is if flag_one is set // AND if flag_two is set. Got it? message "Both flags are set!" // Now, suppose that flag_two was clear? The macro would then skip down // to the next nested ELSE statement, and carry this instruction out. // It would go here only if flag_one is set AND flag_two is clear. ELSE message "Only flag one is set." // This ends our section for checking flag_two, so we must inform // the macro that we're done. Remember END your IF statements! END IF // Okay! We're back out in the first IF comparison for flag_one. // // If flag_one was clear, then the macro would jump down to here, // bypassing the check for flag_two. Since we skipped the flag_two // check, let's take a peek at flag_two to see if it was set of not. // It will print this message only if flag_one is clear AND // flag_two is set. ELSE IF flag_two =< 1 message "Only flag two is set." // ...and should we get here instead, well... ELSE message "None of the flags are set." END IF } I suspect there's a flaw in this macro (I probably need a couple of GOTOs in there to prevent double messages throughout the flag checks pointing to a LABELed exit point at the end of the macro), but hey -- whaddya want for an off-the-cuff macro? No errors? For further reading, the macro manual may be found at: http://www.its.caltech.edu/~barrick/macros/manual.html --Phineas