Programmer's WorkBench (pwb.hlp) (Table of Contents; Topic list)
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.
                                    -♦-