#### Multiple expressions

Typically, each expression takes one line, but you can continue an expression onto the next line if you need more space.

The formula below consists of five expressions. It returns the Number value 25 since that is the value of the last expression in the formula.

##### Example

    //Expressions example
    //The first expression. Its value is the Number
    //value 30
    10 + 20;
    //The second expression. Its value is the String
    //"Hello World". It takes up two lines.
    "Hello " +
    "World";
    //The third expression. Its value is of Number type
    {Orders Detail.Quantity} * 2 - 5;
    //The fourth expression. Its value is of String type
    If {Orders Detail.Quantity} > 1 Then
       "multiple units"
    Else
       "one unit";
    //The fifth and final expression. Its value is the
    //Number value 25
    20 + 5

Placing a semicolon after the last expression in the formula is also allowed, but optional. For example, the above formula could have ended with:

`20 + 5;`

Some of the sample formulas in the preceding section do not have semicolons. This is because they consist of a single expression, and a semicolon is optional after the last expression. Many formulas in Crystal syntax can be written as a single expression.

Notice that there is no semicolon after the "multiple units" String. In fact, if you put a semicolon there, the program will report an error. This is because a semicolon separates expressions, and the

    Else
       "one unit";

is not a separate expression. It does not stand alone apart from the If. In fact, it is an integral part of the If expression since it describes the value that the If expression will return under certain circumstances.

Note: The example is not a practical example because the first four expressions in the formula did not have any effect on the last expression.

Seagate Software, Inc. http://www.seagatesoftware.com Please send comments to: techpubs@seagatesoftware.com