Using Director > Writing Scripts with Lingo > Expressing literal values > Using symbols

 

Using symbols

A symbol is a string or other value that begins with the pound (#) sign.

Symbols are user-defined constants. Comparisons using symbols can usually be performed very quickly, providing more efficient code.

For example, the statement

userLevel = #novice

runs more quickly than the statement

userLevel = "novice" 

Symbols can't contain spaces or punctuation.

Convert a string to a symbol by using the symbol() function. Convert a symbol back to a string by using the string() function.

See # (symbol) operator and string() function.