Sign in Join
Wiki copytemporary

Infinite loop/fi

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

Ikuinen silmukka (tunnetaan loppumattomana luuppina ) on luuppi joka ei koskaan pääty. Luupin sisällä olevia lauseita toistetaan ikuisesti.

pascal

 while true do
   begin
   end;
pascal

 repeat
 until false;

Break lause

"While true do" tai "repeat until false" luupit näyttävät aluksi ikuisilta silmukoilta mutta luupista poistutaan Break lauseella.

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;

Katso myös


From the Free Pascal wiki, page "Infinite loop/fi", as it stood on 2022-08-06 after a change by Kai Burghardt, 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.