Language and Conventions Overview


Continuation and Comments

GRIP provides the means to manipulate line formats to continue a statement on more than one line, and to add program documentation comments which will be ignored during program execution. To make your program easy to edit and trouble-shoot, and make your program readable by other users, you can use spacing and comments to provide documentation in your program.

Some GRIP statements are quite long, and can become difficult to read if written without any spacing. GRIP statements ignore spaces within the parameter fields, therefore you can add them without affecting program execution. Spaces are counted only in regards to the number of characters per line.

For example, the following PARAM statement which creates a menu on the message monitor can be written in several ways. The first version below is valid for execution, but can be difficult to read:

PARAM/'ENTER CIRCLE DIMENSIONS','X COORD',X,$
'Y COORD',Y,'RADIUS',RAD,'START ANG',STANG,$
'END ANG',ENANG,RESP

The same statement is easier to read when written as follows:

PARAM/'ENTER CIRCLE DIMENSIONS',$

'X COORD',X,$
'Y COORD',Y,$
'RADIUS',RAD,$
'START ANG',STANG,$
'END ANG',ENANG,RESP

You can document your program by using Comments as follows:

$$
$$ GET CIRCLE INFORMATION
$$
PARAM/'ENTER CIRCLE DIMENSIONS',$
'X COORD', X,$
'Y COORD', Y,$
'RADIUS', RAD,$
'START ANG', STANG,$
'END ANG', ENANG,RESP

In this case, the comment GET CIRCLE INFORMATION was added just before the menu (PARAM statement) used to get the information to define the circle. Later in the program, just before the CIRCLE statement that creates the circle, the comment CREATING CIRCLE could be added.

 

 

 

L10: $$ REJECT

$$

$$ GET CIRCLE INFORMATION

$$

PARAM/'ENTER CIRCLE DIMENSIONS',$

'X COORD', X,$

'Y COORD', Y,$

'RADIUS', RAD,$

'START ANG', STANG,$

'END ANG', ENANG, RESP

JUMP/L10:,TERM:,,RESP

$$

$$ CREATING CIRCLE

$$

CR1=CIRCLE/X,Y,RAD,START,STANG,END,ENANG