Basic Pascal Tutorial/Chapter 3/REPEAT..UNTIL/zh CN: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: Basic Pascal Tutorial/Chapter 3/REPEAT..UNTIL/zh CN
| Old | New | Line | |
|---|---|---|---|
| 1 | + | REPEAT..UNTIL循环 (原作者: Tao Yue, 状态: 未更改) | |
| 2 | + | ||
| 3 | + | 先循环后判断: | |
| 4 | + | ||
| 5 | + | ``` pascal | |
| 6 | + | repeat | |
| 7 | + | 语句1; | |
| 8 | + | 语句 | |
| 9 | + | until 逻辑表达式; | |
| 10 | + | ``` | |
| 11 | + | ||
| 12 | + | 在repeat循环中,复合语句是内置的,因此,你不需要使用begin-end。另外,直至表达式值为真退出循环。 | |
| 13 | + | ||
| 14 | + | `REPEAT`循环被称之为先循环后判断,任何情况下,循环至少执行一次。 | |
| 15 | + | ||
| 16 | + | ``` pascal | |
| 17 | + | var | |
| 18 | + | sum,count : integer; | |
| 19 | + | ||
| 20 | + | begin | |
| 21 | + | sum := 0; | |
| 22 | + | count := 0; | |
| 23 | + | ||
| 24 | + | repeat | |
| 25 | + | count := count + 1; | |
| 26 | + | sum := sum + count | |
| 27 | + | until (count >= 100); | |
| 28 | + | ||
| 29 | + | writeln('sum=', sum); | |
| 30 | + | end. | |
| 31 | + | ``` | |
| 32 | + | ||
| 33 | + | | | | | | |
| 34 | + | |----|----|----| | |
| 35 | + | | [[Basic Pascal Tutorial/Chapter 3/WHILE..DO/zh CN|上一页]] | [[Basic Pascal Tutorial/Contents/zh CN|目录]] | [[Basic Pascal Tutorial/Chapter 3/FOR..IN/zh CN|下一页]] | | |
| 36 | + | ||
| 37 | + | --- | |
| 38 | + | *From the Free Pascal wiki, page "Basic Pascal Tutorial/Chapter 3/REPEAT..UNTIL/zh CN", as it stood on 2022-08-20 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](/wiki-contact).* |
