VOID

From Director Online Wiki
Jump to: navigation, search

A special constant in Lingo: VOID is the source of much confusion because it is both a value and a type. VOID has a number of unique properties:

  • The type VOID can have only one value: VOID.
  • VOID is numerically equivalent to zero (in most cases, see below --Julian Beak 19:40, 22 Jun 2005 (MDT))
  • VOID is the default value assigned to global variables and properties that have not been explicitly set to anything.

You should always to see whether a value is VOID by using voidP, or testing whether its [ilk] is #void.

The special case where void does not behave numerically equivalent to zero is when you are trying to compare it using greater than (>) in the expression. The example below will yield the following results in the message window:

put ( 0 = 0 )
-- 1
put ( Void = 0  )
-- 1
put ( Void < 1  )
-- 1
put ( 0 > -1 )
-- 1
put ( Void > -1 )
-- 0