contents   index   previous   next

Expressions, statements, and blocks


An expression or statement is any sequence of code that performs a computation or an action, such as the code var TestSum = 4 + 3 which computes a sum and assigns it to a variable. ScriptEase code is executed one statement at a time in the order in which it is read. Many programmers put semicolons at the end of statements, although they are not required. Each statement is usually written on a separate line, with or without semicolons, to make scripts easier to read and edit.


A statement block is a group of statements enclosed in curly braces, "{}", which indicate that the enclosed individual statements are a group and are to be treated as one statement. A block can be used anywhere that a single statement can.


A while statement causes the statement after it to be executed in a loop. By enclosing multiple statements in curly braces, they are treated as one statement and are executed in the while loop. The following fragment illustrates:


while( ThereAreUncalledNamesOnTheList() == true)


   var name = GetNameFromTheList();





All three lines after the while statement are treated as a unit. If the braces were omitted, the while loop would only apply to the first line. With the braces, the script goes through all lines until everyone on the list has been called. Without the braces, the script goes through all names on the list, but only the last one is called. Two very different procedures.


Statements within blocks are often indented for easier reading.