HP Pascal/iX Reference Manual (31502-90022)
Table Of Contents
- Top of Document
- Preface
- Chapter 1 Introduction
- Chapter 2 Language Elements
- Chapter 3 Data Types
- Chapter 4 Expressions
- Chapter 5 The Declaration Section
- Chapter 6 Statements
- Chapter 7 Program Structure
- Chapter 8 Procedures and Functions
- Chapter 9 Standard Routines
- Chapter 10 Input and Output
- Chapter 11 System Programming Extensions
- Chapter 12 Compiler Options
6-: 6
Note that statements between OTHERWISE and END need not be bracketed with
BEGIN..END.
When the system executes a CASE statement, the following occurs:
1. It evaluates the selector.
2. If the value corresponds to a specified case constant, it executes
the statement associated with that constant. Control then passes
to the statement following the CASE statement.
3. If the value does not correspond to a specified case constant, it
executes the statements between OTHERWISE and END. Control then
passes to the statement after the CASE statement. The OTHERWISE
clause must be present or the selector must match any CASE label.
Syntax
Example
PROCEDURE scanner;
BEGIN
get_next_char;
CASE current_char OF
'a'..'z', { Subrange CASE label }
'A'..'Z':
scan_word;
'0'..'9':
scan_number;
OTHERWISE scan_special;