Director Help

# (symbol)

Usage

--Lingo syntax
#symbolName

// JavaScript syntax
symbol("symbolName");

Description

Symbol operator; defines a symbol, a self-contained unit that can be used to represent a condition or flag. The value symbolName begins with an alphabetical character and may be followed by any number of alphabetical or numerical characters.

A symbol can do the following:

  • Assign a value to a variable.
  • Compare strings, integers, rectangles, and points.
  • Pass a parameter to a handler or method.
  • Return a value from a handler or method.

A symbol takes up less space than a string and can be manipulated, but unlike a string it does not consist of individual characters. You can convert a symbol to a string for display purposes by using the string function.

The following are some important points about symbol syntax:

  • Symbols are not case-sensitive.
  • Symbols can’t start with a number.
  • Spaces may not be used, but you can use underscore characters to simulate them.
  • Symbols use the 128 ASCII characters, and letters with diacritical or accent marks are treated as their base letter.
  • Periods may not be used in symbols.

All symbols, global variables, and names of parameters passed to global variables are stored in a common lookup table.

Example

This statement sets the state variable to the symbol #Playing:

-- Lingo syntax
state = #Playing

// JavaScript syntax
var state = symbol("Playing");

See also

ilk(), string(), symbol(), symbolP()