Expressions

In SkookumScript, expressions are all commands, actions and descriptions that are used to describe interactions to the computer. Every expression must have a result.

Even nothing is a result
When an expression’s result object cannot be found or created, nil (which represents ​nothing​) is the result. This is similar to NULL in languages such as C++, though SkookumScript’s nil is itself an object. (More on the nil object later.)

There are five kinds of expressions:

  • Literals create simple, handy building-block objects such as numbers, characters, strings of text, Booleans (true and false), and lists, as well as more sophisticated objects known as closures (which represent a hunk of code as an object).
  • Identifiers reference objects in the language and include variables, data members, and classes. Another form of identifier unique to SkookumScript is an ​object id​, which references objects specified from outside the language (such as items placed in a game editor).
  • Flow-control specifies expression groupings, alternate routes, iterations for code to execute, timings and concurrency.
  • Primitives create and set variables, manage type-checking, and convert objects from one class type to another.
  • Invocations are the mechanisms for calling commands and actions called routines (methods and coroutines), which include special operator symbols for math, comparison and logic.

Expressions can be grouped together using a code block:

[expr1 expr2 expr3]

SkookumScript uses whitespace and comments to separate expressions in code blocks. Expressions do not need end of expression / statement delimiter symbols (;, .) nor even an end-of-line character—the SkookumScript compiler knows what is and is not a valid expression, and figures it out for you.

Some languages (such as X and Y) have many statements, which are contrasted from expressions in that they have no result and are executed primarily for their side-effect behaviour. SkookumScript has no statements, only expressions.