Sign in Join
Wiki copytemporary

Infinite loop/ru: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: Infinite loop/ru

OldNewLine
1+Бесконечный цикл (также известный как непродуктивный или непрерывный цикл) - это цикл, который никогда не заканчивается. Операторы внутри цикла всегда повторяются.
2+
3+``` pascal
4+
5+ while true do
6+ begin
7+ end;
8+```
9+
10+``` pascal
11+
12+ repeat
13+ until false;
14+```
15+
16+## Оператор [[Break/ru|Break]]
17+
18+Циклы "[[While/ru|While]] [[True/ru|True]] [[Do/ru|Do]]" или "[[Repeat/ru|Repeat]] [[Until/ru|Until]] [[False/ru|False]]" на первый взгляд кажутся бесконечными, но при этом возможен выход из цикла с помощью оператора [[Break/ru|Break]].
19+
20+``` pascal
21+
22+var
23+ i:integer;
24+begin
25+ i := 0;
26+ while true do
27+ begin
28+ i := i + 1;
29+ if i = 100 then break;
30+ end;
31+end;
32+```
33+
34+``` pascal
35+var
36+ i:integer;
37+begin
38+ i := 0;
39+ repeat
40+ i := i + 1;
41+ if i = 100 then break;
42+ until false;
43+end;
44+```
45+
46+## См. также
47+
48+- [[True/ru|True]]
49+- [[False/ru|False]]
50+- [[Repeat/ru|Repeat]] [[Until/ru|Until]]
51+- [[While/ru|While]] [[Do/ru|Do]]
52+- [[Break/ru|Break]]
53+
54+---
55+*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](/wiki-contact).*

Back to history