Skip

From BR Wiki
Jump to navigation Jump to search

The Skip (SK) causes the system to skip a specified number of lines or skip to a specified label in a procedure. The SKIP command command now counts blank lines in a procedures file, which may affect your programs.

Comments and Examples

The procedure automatically ends when the number of lines specified in the SKIP command is greater than the number of lines remaining in the procedure. It also ends if a specified label is not found.

The following example skips ten lines of a procedure whenever the value of the variable X equals 25:

SKIP 10 IF X = 25

The next example skips to the procedure line label SAMPLE whenever the value of the variable X equals 35:

SKIP SAMPLE IF X = 35

Syntax

SKIP {<integer>|<proc label>} [IF <condition>] 

Defaults

Always skip.

Parameters

SKIP requires one of two parameters: proc label or int.

Proc label causes BR skip to the procedure line with the specified label. The label can be located on any line of the procedure, either before or after the label reference. A procedure label consists of a colon in the first position and a character string of any length up to 800 characters. Placing additional data on the same line is optional. At least one space must separate the label from any command or statement data included in the line.

Int is an integer value specifying how many lines of the procedure BR skip. This number must be a positive integer from 1 to 9999.

The optional IF condition parameter instructs BR to skip the given number of procedure lines only when a specified condition is true. You may use any legal BR expression. For example, the following SKIP command instructs the system to skip 3 lines only when the value of the variable EMPL is less than 10,000:

SKIP 3 IF EMPL < 10000

The CODE and ERR functions are particularly useful with the SKIP command. Program variables (such as EMPL in the above example) remain active in a procedure file until the system processes a SORT, INDEX, LOAD, or CLEAR command, or until a DIM statement is added to a program.

Technical Considerations

Since the procedure files are closed before the last command is executed, the last command cannot be a SKIP to branch back to an earlier part of the procedure. If you want to end with an option to branch backward, you must add another line (such as a blank line or a remark) to keep the procedure files open.