Default case
branch as part of the case
...
otherwise
statement:
case expression of selector: statement; ... selector: statement otherwise { ``else'' instead of ``otherwise'' is allowed } statement; ... statement end
Use in a structured value of array
type:
[index1: value1; index2: value2 otherwise value_otherwise]
otherwise
starts a series of statements which is executed if no
selector matches expression. In this situation, else
is a
synonym for otherwise
.
otherwise
also defines the default value in an Extended
Pascal structured values of array type.
otherwise
is an ISO 10206 Extended Pascal extension.
program OtherwiseDemo; var i: Integer; a: array [1 .. 10] of Integer value [1: 2; 4: 5 otherwise 3]; begin for i := 1 to 10 do case a[i] of 2: WriteLn ('a[', i, '] has value two.'); 3: WriteLn ('a[', i, '] has value three.'); otherwise WriteLn ('a[', i, '] has neither value two nor three.') end end.