Infinite loop/ru
English · Français · Suomi · Русский
Бесконечный цикл (также известный как непродуктивный или непрерывный цикл) - это цикл, который никогда не заканчивается. Операторы внутри цикла всегда повторяются.
while true do
begin
end;
repeat
until false;Оператор Break
Циклы "While True Do" или "Repeat Until False" на первый взгляд кажутся бесконечными, но при этом возможен выход из цикла с помощью оператора Break.
var
i:integer;
begin
i := 0;
while true do
begin
i := i + 1;
if i = 100 then break;
end;
end;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.