Sign in Join
Wiki copytemporary

Basic Pascal Tutorial/Chapter 3/WHILE..DO/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/WHILE..DO/zh CN

OldNewLine
1+3Db - WHILE..DO循环 (原作者: Tao Yue, 状态: 未更改)
2+
3+先判断后循环:
4+
5+``` pascal
6+while 逻辑表达式 do
7+ 语句;
8+```
9+
10+判断逻辑表达式为真,则继续执行循环;直至表达式为假将退出循环。
11+
12+在循环体中你必须设法改变表达式的值(即,造成为假的条件),否则,它将是一个死循环:
13+
14+``` pascal
15+a := 5;
16+while a < 6 do
17+ writeln (a);
18+```
19+
20+通过改变变量,以避免循环:
21+
22+``` pascal
23+a := 5;
24+while a < 6 do
25+begin
26+ writeln (a);
27+ a := a + 1
28+end;
29+```
30+
31+`WHILE...DO` 称之为先判断后循环,即,在进入循环前,先判断条件是否为真,如果为假,将不会进入循环。
32+
33+| | | |
34+|----|----|----|
35+| [[Basic Pascal Tutorial/Chapter 3/FOR..DO/zh CN|上一页]] | [[Basic Pascal Tutorial/Contents/zh CN|目录]] | [[Basic Pascal Tutorial/Chapter 3/REPEAT..UNTIL/zh CN|下一页]] |
36+
37+---
38+*From the Free Pascal wiki, page "Basic Pascal Tutorial/Chapter 3/WHILE..DO/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).*

Back to history