HPlogo Using NS 3000/iX Network Services: HP 3000 MPE/iX Computer Systems > Chapter 8 NetCI

WHILE Statement

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

The WHILE statement executes commands repeatedly as long as a given expression is true.

The WHILE statement consists of the reserved word WHILE, an expression (condition), commands, and the reserved word ENDWHILE.

When NetCI executes a WHILE statement, the following occurs:

  1. NetCI evaluates the expression which is the condition.

  2. If the condition is true, it executes the subsequent commands in the script file until ENDWHILE is encountered, and then re-evaluates the condition. When the condition becomes false, execution resumes at the next statement or command after ENDWHILE.

  3. If the condition is false, the subsequent commands following this condition will not execute, and flow control skips to statements or commands after ENDWHILE.

Syntax

WHILE expression
commands
ENDWHILE

Parameters

expression

Specifies the condition that determines whether the commands following it will execute. The expression must be in the following format:

     identifier operator identifier

The identifier is a variable name, numerical value, or known variable (set flag) in NetCI. The operator is an equal sign (=), not equal sign (< >), greater than sign (>), or less than (<) sign.

commands

Specifies the commands to be executed provided the expression (condition) is true.

Discussion

The INC statement may be used with the WHILE statement to increase the value of the expression specified with WHILE. Refer to the INC statement which was previously discussed in this section.

Feedback to webmaster