Fatal syntax error until expected but if found

Ошибка: "; expected but until found" PascalABC.NET Решение и ответ на вопрос 1212521

BlackBear

0 / 0 / 0

Регистрация: 15.06.2014

Сообщений: 5

1

19.06.2014, 18:27. Показов 1064. Ответов 2

Метки нет (Все метки)


Проблема: При компиляции пишет что » Встречено untill, а ожидалось ‘;’ «. Все begin и end; поставлены, но всеравно ерипениться. Помогите.
Код:

Pascal
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
var
  a, b, c,i: integer;
 
begin
  c := 0;
  writeln('Введите число от 1 до 10, у вас 5 попыток ');
  randomize;
  a := random(10);
  repeat
    readln(b);   
    if (a = b) then writeln('Вы выиграли') 
    
      else
    begin
      c := c + 1;
      writeln('У вас осталось попыток: ', 5 - c, ' Советую ввести число:');     
      if (b > a) then  
        writeln('Меньше')
      else
      
        writeln('Больше');
      
    end;
    if (c=5) then
    writeln('Отправьте 7677 на номер 00000000 и получи еще 5 попыток');
    begin
    case i of
    3444: begin writeln('Код подтвержден.');  c:=0; end;
    end;
    
    
  until ((a = b) or (c = 5)); { <--- }
end.

__________________
Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь



0



Супер-модератор

Эксперт Pascal/DelphiАвтор FAQ

32456 / 20948 / 8107

Регистрация: 22.10.2011

Сообщений: 36,218

Записей в блоге: 7

19.06.2014, 18:47

2

В 26 строке begin зачем? Вот begin есть а end-а, ему соответствующего, нет (end из строки 29 закрывает case). Вот и сломана структура программы… Либо убирай этот begin, либо в 30 строке добавляй еще end. Тогда программа будет компилироваться, логику работы не проверял, ибо задания нет…



0



0 / 0 / 0

Регистрация: 15.06.2014

Сообщений: 5

19.06.2014, 19:00

 [ТС]

3

Да, действительно задания нет. Я забыл что case нужно end’ом закрывать. Тот end закрывает begin в 26 строке.



0



IT_Exp

Эксперт

87844 / 49110 / 22898

Регистрация: 17.06.2006

Сообщений: 92,604

19.06.2014, 19:00

Помогаю со студенческими работами здесь

Ошибка: «sintax error, «OF» expected, but «[» found»
Здравствуйте, в 4 строке компилятор выдаёт ошибку: &quot;sintax error, &quot;OF&quot; expected, but &quot;var…

Ошибка «Syntax Error, «:» expected but «;» found
Unit SourceModMenu;

interface

Uses Crt;

function Menu(X,Y: integer):integer; //Функция для…

Ошибка: Syntax error, «;» expected but «ELSE» found
Напишите программу, использующую модифицированный алгоритм Евклида: нужно заменять большее число на…

Unit1.pas(51,0) Fatal: Syntax error, «BEGIN» expected but «end of file» found
Вобщем, мне говорят что у меня ошибка в несуществующей строке.
Пишет мне вот это; unit1.pas(51,0)…

Fatal:syntax error,»UNTIL» expected but «indentifier RESET» found
Написала программы а компилятор выдает ошибку что делать??

program lab6;
uses crt;
type

Syntax error, «;» expected but «identifier NUM» found
На IdeOne написал, самое противное, что не показывает, строчку, где не правильно:
program ideone;…

Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:

3

Содержание

  1. Fatal: Syntax error, «.» expected but «;» found
  2. 1 Answer 1
  3. Pascal fatal error «;» expected but else founded
  4. 2 Answers 2
  5. Pascal fatal error «;» expected but else founded
  6. 2 Answers 2
  7. [Паскалъ] Need Help
  8. Почему выдаёт ошибку? Где я накосячила? Ошибка: unit1.pas(120,5) Fatal: Syntax error, «;» expected but «ELSE» found

Fatal: Syntax error, «.» expected but «;» found

1 Answer 1

The reason for this is that your begin s and end s are not balanced; disregarding the opening begin and closing end. for the program’s syntax to be correct, you should have equal numbers of each, but you have 4 begin s and 8 end s.

Obviously, your code is to compute the solutions of a quadratic equation. What I think you should do is to adjust the layout of your code so that it reflects that and then correctly the begin s and end s. In particular, your program is trying to detect whether any of a, b and d is zero and, if so, write a diagnostic message, otherwise calculate the roots by the usual formula.

Unfortunately, your begin s and end s do not reflect that. Either the whole of the block starting d := . needs to be executed or none of it does, so the else on the line before needs to be followed by a begin , as in

(You don’t say which Pascal compiler you are using, but the above fixes two points which are flagged as errors in FreePascal.

If you need more help than that, please ask in a comment.

Btw, there are some grammatical constructs in Pascal implementations where an end can appear without a matching preceding begin such as case . of . end .

Источник

Pascal fatal error «;» expected but else founded

What is causing the fatal error «;» expected but else founded message?

2 Answers 2

Unlike C, in Pascal a semicolon ; separates statements, it does not terminate them, and the then clause requires a single statement. then WriteLn(. ); else is two statements; you want then WriteLn(. ) else .

Let’s take this opportunity to learn how to read and use error messages to your advantage.

The compiler tells you exactly what the error is (it’s a ; before an else , because both of those are mentioned in the error message). It also gives you the exact line number where it’s reporting the error; that’s the number (usually in parentheses right before the error message, like (from Delphi):

[DCC Error] Project2.dpr(14): E2153 ‘;’ not allowed before ‘ELSE’

So the error is happening on line 14 (in my code — your number will be different). Let’s look at that line and a few before and after:

So look at the error message:

That clearly tells you that the ; in the line before the else is the problem (that’s very clear, because it says not allowed), so remove it.

BTW, now you’re going to get another error:

[DCC Error] Project2.dpr(15): E2003 Undeclared identifier: ‘wrtieln’

I think you should be able to figure that one out; again, the compiler gives you the exact line number.

You’re going to get another one, if you’ve posted your entire code:

[DCC Error] Project2.dpr(18): E2029 Statement expected but end of file found

This is because you’ve left out the end. that marks the end of a program file in Pascal. If you’ve not posted your entire code, you may not get it.

It’s important to learn to actually read the words when you get an error message from the compiler. In most languages, the messages are clearly worded, and they all have information you can use to try to figure out (or at least narrow down) the problems in your code.

Источник

Pascal fatal error «;» expected but else founded

What is causing the fatal error «;» expected but else founded message?

2 Answers 2

Unlike C, in Pascal a semicolon ; separates statements, it does not terminate them, and the then clause requires a single statement. then WriteLn(. ); else is two statements; you want then WriteLn(. ) else .

Let’s take this opportunity to learn how to read and use error messages to your advantage.

The compiler tells you exactly what the error is (it’s a ; before an else , because both of those are mentioned in the error message). It also gives you the exact line number where it’s reporting the error; that’s the number (usually in parentheses right before the error message, like (from Delphi):

[DCC Error] Project2.dpr(14): E2153 ‘;’ not allowed before ‘ELSE’

So the error is happening on line 14 (in my code — your number will be different). Let’s look at that line and a few before and after:

So look at the error message:

That clearly tells you that the ; in the line before the else is the problem (that’s very clear, because it says not allowed), so remove it.

BTW, now you’re going to get another error:

[DCC Error] Project2.dpr(15): E2003 Undeclared identifier: ‘wrtieln’

I think you should be able to figure that one out; again, the compiler gives you the exact line number.

You’re going to get another one, if you’ve posted your entire code:

[DCC Error] Project2.dpr(18): E2029 Statement expected but end of file found

This is because you’ve left out the end. that marks the end of a program file in Pascal. If you’ve not posted your entire code, you may not get it.

It’s important to learn to actually read the words when you get an error message from the compiler. In most languages, the messages are clearly worded, and they all have information you can use to try to figure out (or at least narrow down) the problems in your code.

Источник

[Паскалъ] Need Help

Что программа должна делать(на пхп)

ЕМНИП перед else там точка с запятой не ставится.

Не, ругается на другое, и спасибо это пофиксил.

> перед else там точка с запятой не ставится.

> ругается на другое

Условия в скобки попробуй.

Перед else ; не ставится.

У readln точно такой синтаксис? (я уже запамятовал)

Условия в скобки не надо?

Операции сравнения в скобки возьми.

А теперь, дружище, запомни, что вот этот выхлоп

untitled.pas(26,7) Error: Incompatible types: got «Boolean» expected «LongInt»
untitled.pas(28,2) Fatal: Syntax error, «;» expected but «ELSE» found

должен читать ТЫ сам, а не ЛОР.

Свободно говорю на Русском, Литовском, Английском.

Свободно говорю на Английском

Error: Incompatible types: got «Boolean» expected «LongInt»

Fatal: Syntax error, «;» expected but «ELSE» found

Источник

Почему выдаёт ошибку? Где я накосячила? Ошибка: unit1.pas(120,5) Fatal: Syntax error, «;» expected but «ELSE» found

procedure TForm1.RadioButton1Change(Sender: TObject);
begin
if radiobutton1.checked then
begin
edit1.text := IntToStr(Bin2Dec(edit1.text));
CS := 10;
s:=edit1.text
end;
else begin
edit1.text := IntToStr(Oct2Dec(edit1.text));
CS := 10;
s:=edit1.text;

Button1.Enabled:=True;
Button2.Enabled:=True;
Button3.Enabled:=True;
Button4.Enabled:=True;
Button5.Enabled:=True;
Button6.Enabled:=True;
Button7.Enabled:=True;
Button8.Enabled:=True;
Button9.Enabled:=True;
Button10.Enabled:=True;
Button11.Enabled:=True;
Button12.Enabled:=True;
Button13.Enabled:=True;
Button15.Enabled:=True;
Button16.Enabled:=True;
Button17.Enabled:=True;
Button18.Enabled:=True;
Button14.Enabled:=True;
Button19.Enabled:=True;
Button20.Enabled:=True;
Button21.Enabled:=True;
Button22.Enabled:=True;
Button23.Enabled:=True;
end;

—-исходный кусок ————
CS := 10;
s:=edit1.text
end;
else begin
————неправильно, д. б. так ——————-
CS := 10;
s:=edit1.text;
end
else begin

З. Ы. внимательнее с синтаксисом. лучше код форматировать отступами, вроде так:
begin
begin
.
end;
end;
сразу ясно какой энд какому бегину принадлежит )))

Источник

But how do we get
— From: The compiler found an incorrect keyword
— To: Therefore it must expect a keyword (just a different keyword)?

I didn’t say it  must expect a keyword.  What I said is, if it finds a keyword that does not start a new statement, as in the case with «else», then the keyword must be «end».  The reason for that is because the compiler is parsing a compound statement, therefore, it must expect a keyword to terminate the compound statement and, the _only_ keyword that does not start another statement that fulfills the requirement is «end». 

If the keyword «else» is wrong, we can conclude something else must be expected. But that something else can be anything: A new none-empty statement, an empty statement followed by a «;», an «end».

No, it cannot be anything.  What the compiler (Delphi) is saying, if you want a keyword that does not start another statement (as is the case with «else») there then it _must_ be «end». There is no other choice.

FPC stating that it expected a semicolon, in addition to being incorrect, it is also utterly useless because semicolons separate empty statements.  The compiler could ask for 200 semicolons there and achieve just as much.  It’s asking for a semicolon is the same (in that case) as asking for a space characters.  Utterly useless.

Following your argument, that the compiler should treat an unexpected keyword as a special error, then it should simply state
«incorrect keyword»

It’s not a special error.  A compound statement is terminated with «end».  There is no reason for the compiler to go «generic» and state «incorrect keyword» when it knows that the only acceptable keyword that does not start another statement is «end».    Since «else» does not start another statement then the only acceptable keyword that does not start another statement (as «else» is) is «end».

Yet, point in your favour:

  1. repeat

  2. while true do else

gives: Fatal: Syntax error, «UNTIL» expected but «ELSE» found
So it uses the knowledge about the outer block.

It’s not so much that it uses knowledge of the outer block, once the «while» is parsed, execution returns to the «repeat» production to finish parsing it, at that time, it finds an «else».  The only keyword that does not start another statement that «repeat» is going to accept is «until».  Since, «else» does not start another statement, the production demands an «until» keyword, as it should.

Personally, I would like to see the «; expected» error in the last case too. Just for consistency. (As both errors are equally good)

It really shouldn’t do that because, at some point the «repeat» production has to ask/demand the «until» it needs.  It can’t just go asking for another semicolon every time it needs an «until».

Of course, one has to ask why change the error at all.
Purely technically it is correct. (It is not complete, but it is one correct possibility, and neither would «end expected» be complete).

No, technically, it is incorrect.  That’s the problem, a compound statement is not ended with a semicolon, it’s ended with an «end» keyword.  It can’t keep asking for semicolons endlessly.  It really has to ask for the «end» and it has to ask for it whenever it  see a symbol that does not start a new statement, whatever it may be.

The reasons to change an error message are:
1- It is plain wrong (but this is a subset of the next point)
2- The message can be improved to give the user a better idea what is wrong.

The first does not apply.

On the contrary, the first applies in full.  The compound statement is not asking for its terminating symbol, that’s incorrect/wrong/bad/no good/trump.

Given that «;» is statistically more likely, the «; expected» error is actually ever so slightly more helpful.

Not if the programmer wants to eventually have a program that compiles because all the semicolons in the universe put before the else aren’t going to do it.


It is basically a summary of the state of the parser, not a correction advise. 

Error messages are not correction advise ? … if doing what they state isn’t going to lead to a correct statement then why does the compiler bother emitting them ?…  ascii visual entertainment ?…

Example: Delphi gives the exact same error for this code:

But, here is the thing you are attempting to avoid.  If you follow Delphi’s corrective «suggestions» (not advice, of course) you will eventually end up with a program that compiles.

Attempting to use FPC’s «ascii visual entertainment» yields a request for more and more semicolons and never a program that compiles successfully.

That applies to the example you showed.  I used your example.  Followed Delphi’s «suggestions» and after a few compiles had a syntactically correct program.  If I were still following FPC’s suggestion (not advice!) this entire post would be semicolons and the program would still not compile (and not ever compile.)

I think the Delphi solution is inferior.

Interesting that the solution that leads to a syntactically correct program is «inferior» while the «solution» that has the programmer adding semicolons for infinity is not inferior.

Anyway, I just wanted to know if there was interest in having correct error message.  I have the answer and, have no doubt about what it is.

program lab6;
  uses crt;
  type
    avtor=record
      fam:string[12];
      im:string[3];
      ot:string[3];
    end;
    izdanie=record
      izdat:string[21];
      gorod:string[16];
      god:integer;
      kolstr:integer;
    end;
    book=record
      a:avtor;
      nazv:string[49];
      izd:izdanie;
      prod:array[1..3] of integer;
    end;
    var
      f1:text;
      fname:string[80];
      res:integer;
      otv:char;
      books1:array[1..100] of book;
      books2:array[1..100] of book;
      min:array[1..100] of integer;
      i,j,n,m:integer;
      namegorod:string[16];
      minium:integer;
    begin
      clrscr;
        repeat
          writeln('Enter file name');
          write('->');
          readln(fname);
          assign(f1,fname)
          {$I-}
          reset(f1);{Вот тут показывает ошибку!!}
          {$I+}
          res:=IOResuet;
          if res<>0 then
            begin
              writeln;
              writeln('Error');
              writeln('y-yes,n-no');
              readln(otv);
              writeln;
            end;
        until (res=0) or (otv='n');
               i:=1;
      while not EOF(f1) do
        begin
          with books1[i] do
          readln(f1,a.fam,a.im,a.ot,nazv,izd.izdat,izd.gorod,izd.god,izd.kolstr,prod[1],prod[2],prod[3]);
          i:i+1;
        end;
      n:=i-1;
      close(f1);
      assign(f1,'vspom.txt')
      reset(f1);
      read(f1,namegorod);
      close(f1);
      j:=1;
      for i:=1 to n do
        if books1[i].izd.gorod=namegorod then
          begin
            books2[j]:=books1[i];
            j:=j+1;
          end;
      m:=j-1;
      for j:=1 to m do
        with books2[j] do
          begin
            minium:=prod[1];
            if prod[2]<minium then
              mimium:=prod[2];
            if prod[3]<minium then
              minium:=prod[3];
            min[j]:=minium;
          end;
      writeln;
      writeln('Enter file name');
      write('->');
      readln(fname);
      assign(f1,fname);
      rewrite(f1);
      for j:=1 to m do
        with books2[j] do
          begin
            write(f1,a.fam,a.im,a.ot,nazv,izd.izdat,izd.dorod,izd.god,izd.kolstr,'   ',prod[1],'   ',prod[2],'   ',prod[3]);
            writeln(f1,'   ',min[j]);
         end;
      close(f1);
      write('press any key');
      readkey;
end.

>
Как исправить ошибку

  • Подписаться на тему
  • Сообщить другу
  • Скачать/распечатать тему



Сообщ.
#1

,
17.04.11, 16:14

    Есть код. Говорит ошибка
    строка 69 (предпоследняя строка)Ожидалось ‘;’

    ExpandedWrap disabled

      PROGRAM EXAMPLE;

      USES CRT;

      VAR X1,A1,Y1:REAL;             {  ОПИСАНИЕ  ПЕРВОЙ ЗАДАЧИ  }

          K:REAL;   {  ОПИСАНИЕ  ВТОРОЙ ЗАДАЧИ  }

          X3,Y3,Z:REAL;             {  ОПИСАНИЕ  ТРЕТЬЕЙ ЗАДАЧИ  }

          SELECTOR:BYTE;

      BEGIN

         REPEAT

            CLRSCR;                  {  ОЧИСТКА   ЭКРАНА       }

            WRITELN(‘   ВВЕДИТЕ  НОМЕР  ЗАДАЧИ  СОГЛАСНО  МЕНЮ : ‘);

            WRITELN;

            WRITELN(‘ 1………ЗАДАЧА 1            ‘);

            WRITELN(‘ 2………ЗАДАЧА 2            ‘);

            WRITELN(‘ 3………ЗАДАЧА 3            ‘);

            WRITELN(‘ 4………ВЫХОД ИЗ ПРОГРАММЫ  ‘);

            READLN(SELECTOR);

            CASE  SELECTOR  OF

      1:  BEGIN      {  ПЕРВАЯ  ЗАДАЧА   }

                      CLRSCR;

                      WRITELN(‘ВВЕДИТЕ ВЕЩЕСТВЕННЫЕ ЧИСЛА  X  И  A ‘);

                      READLN(X1,A1);

                      IF  X1<2*A1  THEN  Y1:=-sqrt(sqr(a1)-sqr(x1-a1))

                                 ELSE  Y1:=a1*(1-exp((a1-x1)*ln(e)));

                      WRITELN(‘A=’,A1:5:3,’ X=’,X1:5:3,’ Y=’,Y1:5:3);

                      WRITELN;WRITELN;

       WRITELN(‘НАЖМИТЕ ENTER ДЛЯ ПРОДОЛЖЕНИЯ’);

      READLN;

      END;       {  КОНЕЦ  ПЕРВОЙ  ЗАДАЧИ  }

                       2:  BEGIN      {  ВТОРАЯ   ЗАДАЧА         }

                      CLRSCR;

                      WRITELN(‘ВВЕДИТЕ  ВЕЩЕСТВЕННЫЕ ЧИСЛА А  И  Х  ‘);

                      READLN(K);

                      CASE  K  OF

                      ‘a’..’z’,’A’..’Z’:write(‘Латинский’);

      ‘а’..’я’, ‘ё’,’А’..’Я’:write(‘Русский’);

      ‘0’..’9′:write(‘Цифра’);

                                       END;  { CASE }

                                     WRITELN;WRITELN;

       WRITELN(‘НАЖМИТЕ ENTER ДЛЯ ПРОДОЛЖЕНИЯ’);

                      READLN;

                   END;       {  КОНЕЦ ВТОРОЙ  ЗАДАЧИ   }

               3:  BEGIN      {  ТРЕТЬЯ   ЗАДАЧА         }

                      CLRSCR;

                                var x,y:integer;

      begin

        Write(‘ВВЕДИТЕ КООРДИНАТЫ ТОЧКИ  X: ‘);

        ReadLn(x);

        Write(‘ВВЕДИТЕ КООРДИНАТЫ ТОЧКИ  Y: ‘);

        ReadLn(y);

        if ( (x > 3) or (x < -3) ) then WriteLn(‘ТОЧКА НЕ ПРИНАДЛЕЖИТ ОБЛАСТИ’)

        else if ( (y > 1 ) or (y < -2) ) then WriteLn(‘ТОЧКА НЕ ПРИНАДЛЕЖИТ ОБЛАСТИ’)

        else if ( (x < -1) and (y < 0) ) then WriteLn(‘ТОЧКА НЕ ПРИНАДЛЕЖИТ ОБЛАСТИ’)

        else if ( (x > 1)  and (y < 0) ) then WriteLn(‘ТОЧКА НЕ ПРИНАДЛЕЖИТ ОБЛАСТИ’)

        else WriteLn(‘ТОЧКА ПРИНАДЛЕЖИТ ОБЛАСТИ’);

        WRITELN;WRITELN;

                WRITELN(‘НАЖМИТЕ ENTER ДЛЯ ПРОДОЛЖЕНИЯ’);

        Readln;

      end; {  КОНЕЦ  ТРЕТЬЕЙ  ЗАДАЧИ  }

              4:  EXIT;      {  ВЫХОД  ИЗ  ПРОГРАММЫ }

            END;   {  CASE  }

         UNTIL  FALSE;

      END.

    Сообщение отредактировано: volvo877 — 18.04.11, 08:10


    andriano



    Сообщ.
    #2

    ,
    17.04.11, 17:01

      > UNTIL FALSE;

      А действительно, что ты хотел сказать этим оператором?


      Polinom2686



      Сообщ.
      #3

      ,
      17.04.11, 18:34

        Senior Member

        ****

        Рейтинг (т): 13

        Цитата andriano @ 17.04.11, 17:01

        А действительно, что ты хотел сказать этим оператором?

        Бесконечный цикл.

        Добавлено 17.04.11, 18:46
        После строки

        ExpandedWrap disabled

          end; { КОНЕЦ ТРЕТЬЕЙ ЗАДАЧИ }

        не хватает end, который закроет

        ExpandedWrap disabled

          3: BEGIN { ТРЕТЬЯ ЗАДАЧА }

        P.S. пиши код с отступами.

        Сообщение отредактировано: Polinom2686 — 17.04.11, 18:47

        Guru

        volvo877



        Сообщ.
        #4

        ,
        18.04.11, 08:20

          Moderator

          *******

          Рейтинг (т): 878

          Код был написан с отступами. Только, чтобы это увидеть, надо использовать тэги подсветки, а не цитаты…

          yana33311, кнопка «CODE=pas», а не QUOTE.

          Цитата Polinom2686 @ 17.04.11, 18:34

          не хватает end, который закроет

          Этого недостаточно. Тут вся структура программы порушена. Что за переменная e в 25-ой строке, где она описана? Есть функция exp, переменной e готовой нет. Как может компилироваться строка №39 (Case K Of), когда K описана как Real? Что за описание переменных внутри Case-а (49 строка)?

          Ошибок гораздо больше на самом деле (лень проверять в TP, проверил в FPC):

          ExpandedWrap disabled

            test.pp(25,66) Error: Identifier not found «e»

            test.pp(35,32) Error: Ordinal expression expected

            test.pp(36,31) Error: Constant and CASE types do not match

            test.pp(36,40) Error: Constant and CASE types do not match

            test.pp(36,40) Error: duplicate case label

            test.pp(37,15) Error: Constant and CASE types do not match

            test.pp(37,15) Error: duplicate case label

            test.pp(37,20) Error: Constant and CASE types do not match

            test.pp(37,29) Error: Constant and CASE types do not match

            test.pp(37,29) Error: duplicate case label

            test.pp(38,15) Error: Constant and CASE types do not match

            test.pp(38,15) Error: duplicate case label

            test.pp(49,33) Error: Illegal expression

            test.pp(49,37) Fatal: Syntax error, «;» expected but «identifier X» found

            test.pp(0) Fatal: Compilation aborted

          Я не думаю, что какой-то компилятор Паскаля проглотит все это, и оставит только

          Цитата yana33311 @ 17.04.11, 16:14

          строка 69 (предпоследняя строка)Ожидалось ‘;’


          andriano



          Сообщ.
          #5

          ,
          18.04.11, 18:56

            Цитата Polinom2686 @ 17.04.11, 18:34

            Бесконечный цикл.

            Что это именно бесконечный цикл — понятно. Непонятно — зачем.


            Polinom2686



            Сообщ.
            #6

            ,
            18.04.11, 19:17

              Senior Member

              ****

              Рейтинг (т): 13

              Цитата andriano @ 18.04.11, 18:56

              Что это именно бесконечный цикл — понятно. Непонятно — зачем.

              Все, что между Repeat и Until, должно повторятся до тех по пока пользователь сам не захочет выйти из программы.


              andriano



              Сообщ.
              #7

              ,
              19.04.11, 16:34

                Цитата Polinom2686 @ 18.04.11, 19:17

                Все, что между Repeat и Until, должно повторятся до тех по пока пользователь сам не захочет выйти из программы.

                Разве это называется «бесконечный цикл»?
                Это называется «цикл по условию».

                ExpandedWrap disabled

                  repeat

                  until пользователь_захотел_выйти_из_программы;


                Polinom2686



                Сообщ.
                #8

                ,
                19.04.11, 16:38

                  Senior Member

                  ****

                  Рейтинг (т): 13

                  Цитата andriano @ 19.04.11, 16:34

                  Разве это называется «бесконечный цикл»?
                  Это называется «цикл по условию».

                  Да, это цикл

                  ExpandedWrap disabled

                    Repeat

                    Until <Условие>

                  с постусловием.

                  А это

                  ExpandedWrap disabled

                    Repeat

                    Until FALSE

                  бесконечный цикл с постусловием. :)

                  Guru

                  volvo877



                  Сообщ.
                  #9

                  ,
                  19.04.11, 17:16

                    Moderator

                    *******

                    Рейтинг (т): 878

                    Цитата Polinom2686 @ 19.04.11, 16:38

                    бесконечный цикл с постусловием.

                    здесь использовать глупо. Гораздо корректнее было бы написать

                    ExpandedWrap disabled

                      repeat

                         // …

                         readln (Selector);

                         case Selector of

                         // …

                         end;

                      until Selector = 4;

                    Да эту программу вообще проще с нуля переписать, чем править ошибки…

                    Все-таки, может дождемся автора, узнаем, что у него за компилятор, что уже исправлено, интересует ли его вообще эта программа до сих пор, а не будем углубляться в словоблудие и терминологию? andriano, в первую очередь это касается тебя…

                    Сообщение отредактировано: volvo877 — 19.04.11, 17:18

                    0 пользователей читают эту тему (0 гостей и 0 скрытых пользователей)

                    0 пользователей:

                    • Предыдущая тема
                    • Pascal
                    • Следующая тема

                    [ Script execution time: 0,0369 ]   [ 15 queries used ]   [ Generated: 12.02.23, 18:39 GMT ]  

                    Понравилась статья? Поделить с друзьями:

                    Читайте также:

                  • Fatal syntax error then expected but found
                  • Fatal syntax error expected but var found
                  • Fatal syntax error expected but uses found
                  • Fatal syntax error expected but procedure found
                  • Fatal syntax error expected but identifier writeln found

                  • 0 0 голоса
                    Рейтинг статьи
                    Подписаться
                    Уведомить о
                    guest

                    0 комментариев
                    Старые
                    Новые Популярные
                    Межтекстовые Отзывы
                    Посмотреть все комментарии