void

action

Syntax
void expression


Purpose

The void action is used to evaluate an expression, but to throw away the resulting value. This is useful when the expression has side-effects that are desired, but the actual value generated by the expression is of no interest.

expression must be an expression of an unqualified type: that is, integer, string, switch, an opaque type, or a record type. If expression is of type string source, it is first implicitly converted to a string; this drains expression.

Although expression can be any expression of an unqualified type, the most common use of void is when expression contains a function call.

Example

OmniMark's system-call operator executes an operating system command, and returns the integer return code from the command. This code is often of little interest. Rather than writing

       process
          local integer i
  
          set i to system-call "<operating system command>"

which generates a warning (because the shelf I is assigned a value but never used), the following can be written

       process
          void system-call "<operating system command>"