title: Pascal Illegal Expression
body: <p>It stops compiling at lines 54 and 58 with errors 'Error: Illegal expression' and 'Syntax error, ; expected but ELSE found' respectively. Is my position of the lines wrong?    </p>
  
  <pre><code>Procedure PlayDiceGame(PlayerOneName, PlayerTwoName : String;
                             VirtualDiceGame : Boolean; Var TopScores : TTopScores);
        Var
          PlayerOut : Boolean;
          CurrentPlayerScore : Integer;
          AppealDieResult : Integer;
          PlayerNo : Integer;
          PlayerOneScore : Integer;
          PlayerTwoScore : Integer;
          BowlDieResult : Integer;
          RunsScored : Integer;
          NumberOfBalls : Integer;
        Begin
          For PlayerNo := 1 To 2
            Do
              Begin
              NumberOfBalls := 0;
                CurrentPlayerScore := 0;
                PlayerOut := False;
                If PlayerNo = 1
                  Then Writeln(PlayerOneName, ' is batting')
                  Else Writeln(PlayerTwoName, ' is batting');
                Writeln;
                Writeln('Press the Enter key to continue');
                Readln;
                Repeat
                  BowlDieResult := RollBowlDie(VirtualDiceGame);
                  If BowlDieResult In [1..4]
                    Then
                      Begin
                        RunsScored := CalculateRunsScored(BowlDieResult);
                        DisplayRunsScored(RunsScored);
                        CurrentPlayerScore := CurrentPlayerScore + RunsScored;
                        Writeln('Your new score is: ', CurrentPlayerScore);
                      End;
                  If BowlDieResult = 5
                    Then Writeln('No runs scored this time.  Your score is still: ',
                                CurrentPlayerScore);
                  If BowlDieResult = 6
                    Then
                      Begin
                        Writeln('This could be out... press the Enter key to find out.');
                        Readln;
                        AppealDieResult := RollAppealDie(VirtualDiceGame);
                        DisplayAppealDieResult(AppealDieResult);
                        If AppealDieResult &gt;= 2
                          Then PlayerOut := True
                          Else PlayerOut := False;
                      End;
                  Writeln;
                  Writeln('Press the Enter key to continue');
                  Readln;
                  NumberOfBalls = NumberOfBalls + 1
                Until PlayerOut or (NumberOfBalls = 6);
                If (NumberOfBalls = 6) Then
                Writeln('You have faced 6 balls and compeletd your innings');
                Writeln('Your final scoare was: ', CurrentPlayerScore);
                Else
                Writeln('You are out.  Your final score was: ', CurrentPlayerScore);
                Writeln;
                Writeln('Press the Enter key to continue');
                Readln;
                If PlayerNo = 1
                  Then PlayerOneScore := CurrentPlayerScore
                  Else PlayerTwoScore := CurrentPlayerScore;
              End;
          DisplayResult(PlayerOneName, PlayerOneScore, PlayerTwoName, PlayerTwoScore);
          If (PlayerOneScore &gt;= PlayerTwoScore)
            Then
              Begin
                UpdateTopScores(TopScores, PlayerOneName, PlayerOneScore);
                UpdateTopScores(TopScores, PlayerTwoName, PlayerTwoScore);
              End
            Else
              Begin
                UpdateTopScores(TopScores, PlayerTwoName, PlayerTwoScore);
                UpdateTopScores(TopScores, PlayerOneName, PlayerOneScore);
              End;
          Writeln;
          Writeln('Press the Enter key to continue');
          Readln;
        End;
  </code></pre>