swirl Guide to OmniMark 5   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesOMX VariablesErrors
 
  Related Syntax    
action   assert    

Syntax

  assert test-expression (message string-expression)?


Purpose

You can use assert to verify any assumptions you are making at any given point in your code. To test an assumption, insert the word assert at an appropriate point in your code and follow it with a test expression that tests your assumption. If the test condition returns true, your program continues. If the test expression returns false, OmniMark throws a #program-error (error code 6133). You can specify an error message to accompany the error by adding a message parameter:

  global integer number-of-guesses initial {10}

  process
     assert number-of-guesses > 0
      message "Illegal value for number-of-guesses"
     output "You have "
         || "d" % number-of-guesses
         || " guesses"

In this program the number of guesses is a global variable and is configurable on the command line. The assert statement tests to make sure that it is not set to a value that does not make sense.

    Related Syntax
   not-reached
 
 
----

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

Generated: August 11, 2000 at 3:06:58 pm
If you have any comments about this section of the documentation, send email to docerrors@omnimark.com

Copyright © OmniMark Technologies Corporation, 1988-2000.