Sign in Join
Wiki copytemporary

Infinite loop/ru

English · Français · Suomi · Русский

Бесконечный цикл (также известный как непродуктивный или непрерывный цикл) - это цикл, который никогда не заканчивается. Операторы внутри цикла всегда повторяются.

pascal

 while true do
   begin
   end;
pascal

 repeat
 until false;

Оператор Break

Циклы "While True Do" или "Repeat Until False" на первый взгляд кажутся бесконечными, но при этом возможен выход из цикла с помощью оператора Break.

pascal

var
  i:integer;
begin
  i := 0;
  while true do
    begin
      i := i + 1;
      if i = 100 then break;
    end;
end;
pascal
var
  i:integer;
begin
  i := 0;
  repeat
    i := i + 1;
    if i = 100 then break;
  until false;
end;

См. также


From the Free Pascal wiki, page "Infinite loop/ru", as it stood on 2020-02-17 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 1, last changed by WikiArchive .

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.