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

do, done

 
 

Syntax

  do action* done


Purpose

You can use do and done to create a block of code that will be treated as a unit. There are two reasons to do this: to limit the scope of variables, and to associate more than one action with a using statement:

  open my-file as file "mine.txt"
  using output as my-file
  do
     local stream bio
     set bio to  "more about me"
     output "my name"
     output bio
  done

The variable "bio" exists only within the do...done block. All output within the block is sent to the destination specified by the preceding using statement.

A do...done block may contain only actions. It cannot contain rules or group statements.

It is possible to apply a condition to a whole do...done block by adding a condition after the done. Conditions appearing after the done apply to the whole block, and are evaluated prior to any conditions that appear within the block. For example, the actions within the following do...done block will be executed only when the attribute "margin" of the parent element is specified:

  do
     decrement page-width by attribute margin
     using attribute margin of parent output "\newmarg{%v(margin)}%n"
  done when attribute margin of parent is specified

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

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.