Sign in Join
Wiki copytemporary

Basic Pascal Tutorial/Chapter 3/WHILE..DO/zh CN

English · Français · Български · 中文(中国) · 日本語

3Db - WHILE..DO循环 (原作者: Tao Yue, 状态: 未更改)

先判断后循环:

pascal
while ??????????????? do
  ??????;

判断逻辑表达式为真,则继续执行循环;直至表达式为假将退出循环。

在循环体中你必须设法改变表达式的值(即,造成为假的条件),否则,它将是一个死循环:

pascal
a := 5;
while a < 6 do
  writeln (a);

通过改变变量,以避免循环:

pascal
a := 5;
while a < 6 do
begin
  writeln (a);
  a := a + 1
end;

WHILE...DO 称之为先判断后循环,即,在进入循环前,先判断条件是否为真,如果为假,将不会进入循环。

上一页 目录 下一页

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.

Revision 1, last changed by WikiArchive .

Edited on wiki.freepascal.org by 5 people, 2013–2022

From the official wiki's backup of 26 May 2024: who edited this page there, and when. Edits made there after that date were not recorded, and the earlier versions are not shown here; the main page says why.

WhenWhoWhat changed
WangyouworldCreated page
Swen (minor)
FTurtle
TrevFixed syntax highlighting; deleted category included in page template (minor)
Kai BurghardtKai Burghardt moved page WHILE..DO/zh CN to Basic Pascal Tutorial/Chapter 3/WHILE..DO/zh CN: tidy up main name space: create subpage hierarchy for basic Pascal tutorial [cf. [[Special: PermaLink/14... (minor)
Kai Burghardtbypass redirects [cf. discussion]
Kai Burghardtlinkfix (minor)
Kai Burghardtbypass language bar/categorization template redirect [cf. discussion] (minor)

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.