Braces and Semicolons

A node definition consists of one or more statements. If the definition contains more than one statement, then each statement must end with a semicolon and the group of statements must be enclosed within braces. This creates a statement block. The example below contains three separate statements.

Profit:={
    var sales=100;
    var costs=60;
    return sales-costs;
}

In JavaScript, semicolons are optional inside statement blocks. However, omitting semicolons is generally regarded as bad programming practice because it leads to code behaving in a way you did not expect. For this reason, semicolons are required in DScript statement blocks.

If the node definition contains only one statement, no braces or semicolons are required.

Profit:=Sales-Costs

See About Nodes.