Just like any scripting language, Lingo has certain elements that you use and rules that you follow.
Lingo terms fall into seven categories:
A Lingo statement is any valid instruction that Director can execute.
An expression is any part of a statement, meant to be taken as a whole, that produces a value.
For example, 2 + 2 is an expression but is not a valid statement all by itself.
The line go to frame 23 is a statement -- go to is the command, and frame 23 is the expression that produces the value that the command requires to execute the instruction.
Lingo supports a variety of data types:
Scripts can use variables to store, update, and retrieve values as the movie plays. Use the equals operator (=) or the set command to assign values to variables or change the values of many properties.
Use if...then, case, and repeat loop structures to set up statements so that they run when specific conditions exist.
For example, you can create an if...then structure that tests whether text has finished downloading from the Internet and then attempts to format the text if it has.
Director always executes Lingo statements in a handler starting with the first statement and continuing in order until it reaches the final statement or a statement that instructs Lingo to go somewhere else.
Some statements that send Lingo to somewhere other than the next statement are repeat loops, ifŠthenŠelse structures, the exit command, the return function, and handler names placed within scripts. The order in which statements are executed affects the order in which you should place statements. For example, if you write a statement that requires some calculated value, you need to put the statement that calculates the value first. For instance, in the following example, the first statement adds two numbers, and the second assigns them to a field cast member to be displayed on the Stage:
x = 2 + 2 put x into member "The Answer"