Coding an Operation
The specification contains sets of statements which cause operations or activations to take place. The following example shows a menu activation:
'Exit' =
begin
message 'Exiting...';
sleep 3;
exit;
end
In this case, the word "Exit" appears as part of the menu for the frame. The user executes the statement sequence by choosing Exit.
"Exit" is a reserved word, so it is given quotation marks in the example. Quotes around the menu item name are not required unless it contains a reserved word. However, it is a good idea to use quotes to avoid any possible conflict.
Indicate the beginning and end of the statement series with the keywords begin and end, as shown in the example. You can use braces in place of the begin and end statements:
'Exit' = /* Exit the application */
begin
message 'Exiting . . .';
sleep 3;
exit;
end
Following the begin and preceding the end are the statements that accompany the menu operation. These statements are separated from each other by semicolons (;), which are required. You can write the statement list on several lines. Do not follow begin and end with semicolons.
Comments
A comment line follows the first line of code of the Exit menu operation in the example above. A comment is an arbitrary sequence of characters bounded by "/*" on the left and by "*/" on the right:
/* This is a comment */
Comments are a useful way to label the parts of the specification clearly. You can place these wherever you can place a blank space or carriage return. A comment can extend over more than one line, but cannot be nested.
Last modified date: 04/03/2024