Note: The syntactic ambiguity arising from the construct 

is resolved by interpreting the construct as equivalent to 

Examples of if statements: 

if e1 then if e2 then sl else s2 

if e1 then begin if e2 then sl else s2 end 

if x < 1.5 then W := X + Y else W := 1.5 if P1 <> nil then PI := P1t.Father 

9.2.2.2. Case statements. The case statement consists of an ordinal expression (the case index) and a list of statements, each being prefixed by one or more constants of the type of the case index. It specifies that the one statement be executed that is prefixed by the value of the case index; it is an error if no constant denoting that value prefixes any statement. Each value must be specified by at most one case constant. 

CaseStatement = "case" Caselndex "of" Case I ";" Case I [ ";" 1 "end" . Caselndex = OrdinalExpression . Case = Constant I "," Constant I ":" Statement. 

Examples of case statements: 

case Operator of Plus: W.- X + Y; Minus: W:= X - Y; Times: W:= X * Y end case I of 1 : Y .- sin (X) ; 2 : Y cos (X) ; 3 : Y exp (X) ; 4 : Y .- In(X) end case P1t.Status of Married, Coupled: P2.- P1t.SignificantOther; Single: P2:= nil; end 

9.2.3. Repetitive statements. Repetitive statements specify that certain statements are to be executed repeatedly. If the number of repetitions is known beforehand, i.e., before the repetitions are started, the for statement is often the appropriate construct; otherwise the while or repeat statement should be used. 

