Programmer's WorkBench (pwb.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
Macro Conditional Example
                                             Up Contents Index Back
─────Programmer's WorkBench─────────────────────────────────────────────────
 
     Macro conditionals allow you to test the return value of PWB
     functions and execute different branches of the macro depending on
     the result of the test.
 
     The macro below shows the PWB idiom for an 'if-then-else':
 
          QueryHelp := Arg "Get Help On:" Prompt ->no  \
                       Pwbhelp =>  \
                  :>no Arg "Query Cancelled" Message
 
     The '->no' directive tests the result of the Prompt function. When
     Prompt returns False (the user chooses Cancel), the macro branches
     to the label No, skipping the Pwbhelp function. When Prompt returns
     True (the user chooses OK), the conditional is not satisfied, no
     branch is taken, and Pwbhelp is executed.
 
     The '=>' directive branches to the end of the macro, skipping the
     part of the macro after the label No.
                                    -♦-