Skip to main content

Symbol

The Symbol type represents a unique identifier. The only other value equal to the symbol is itself. Symbols are much faster to compare than strings and should be used instead of strings where possible. See the Symbols page to learn more about declaring and using symbols.

// Create inline symbols using the $name syntax
const x = $abc
x == $abc // true
x == $def // false

// You can declare your symbols so that the compiler can check they exist
pub symbol WantsFireball
owner.PrimarySlot = WantsFireball

// Private symbols are prefixed with their filename by the compiler
// so they cannot clash with another symbol of the same name in another file.
// Filename: file1.easel
pub symbol PublicSymbol
symbol PrivateSymbol
Transmission { %(PublicSymbol) } // outputs $PublicSymbol
Transmission { %(PrivateSymbol) } // outputs $file1.easel/PrivateSymbol