swirl
Guide to OmniMark 7   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesLegacy LibrariesErrors
 
  Related Syntax   Related Concepts  
control structure  

do when, do unless

 
 

Syntax

  do (when|unless) condition?
     local declaration*
     action*
  (else condition
     local-declaration*
     action*)*
  (else
     local-declaration*
     action*)?
  done


Purpose

You can use do when and do unless to make a group of actions conditional:

  do when count > 5
     output "more than 5"
  done

You can use else to specify actions to be taken if the condition is not met:

  do when count > 5
     output "more than 5"
  else
     output "less than 6"
  done

You can use one or more else when statements to provide multiple conditional alternatives:

  do when count > 5
     output "more than 5"
  else when count = 5
     output "exactly 5"
  else
     output "less than 5"
  done

In all these circumstances you can use do unless in place of do when to reverse the test. do unless is equivalent to do when not, but in many cases do unless will be more readable.

    Related Syntax
   do select, select, case
   do sgml-parse
   do skip
   do scan
   do xml-parse
   when, unless
 
Related Concepts
   Conditional constructs
 
 

Top [ INDEX ] [ CONCEPTS ] [ TASKS ] [ SYNTAX ] [ LIBRARIES ] [ LEGACYLIBRARIES ] [ ERRORS ]

OmniMark 7.1.2 Documentation Generated: June 28, 2005 at 5:45:11 pm
If you have any comments about this section of the documentation, send email to [email protected]

Copyright © Stilo Corporation, 1988-2005.