-
Notifications
You must be signed in to change notification settings - Fork 2
statements
A HS program is a sequence of statements, or expressions separated by semicolons. Expressions consist of numbers, names, and operators.
HS statements are parsed using a recursive descent algorithm; as soon as both operands of a (sub)expression are known, the expression is evaluated.
For details on operators, expressions, and statements, see:
You can use any valid expression as a statement by terminating it with a semicolon:
expression ;
_
An invalid expression generates the unrecoverable error code %EXPRESSION, which can be trapped by a handler using the on_error statement.
A compound statement, also called a block, allows more than one statement to appear where the language requires a single statement. A compound statement has the form:
{ statement-list }
_
That is, the block is a list of statements, all enclosed in braces.
Control structures consist of statements that control the flow of a program's execution.
For details on specific control statements, see:
- Decision Statements: Selection statements used for branching.
- Iteration Statements: Loop statements used for repetitive operations.
- Handler Statements: Statements for handling run-time conditions.
- Working with Control Structures: Nested control structures, goto statement, exiting from loops and methods.
The enable and disable statements expose or hide a method from being executed by an external HS program. The form of these statements is:
enable method ;
**disable** method ;
_
When an EVENT or QUERY message is received by a HS program in the IDLE state, the method specified will be executed only if it is defined and enabled. See the section on Messages for more information on the event and query messages.
The null statement is expressed as ";". Specified by itself, a semi-colon is equivalent to a no-op instruction.
Comments, when used judiciously, can greatly enhance the readability and understanding of a program. A comment section begins with "/*" and ends with "*/". For example:
/*
This is a comment.
*/
_