Difference between revisions of "Basic Pascal Tutorial/Chapter 3/WHILE..DO/zh CN"
From Lazarus wiki
Jump to navigationJump to searchWangyouworld (talk | contribs) (Created page with "3Db - WHILE..DO循环 (原作者: Tao Yue, 状态: 未更改) 先判断后循环: <syntaxhighlight> while 逻辑表达式 do 语句; </syntaxhighlight> 判断逻辑表...") |
m (bypass language bar/categorization template redirect [cf. discussion]) |
||
(6 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
+ | {{Basic Pascal Tutorial/Chapter 3/WHILE..DO}} | ||
+ | |||
3Db - WHILE..DO循环 (原作者: Tao Yue, 状态: 未更改) | 3Db - WHILE..DO循环 (原作者: Tao Yue, 状态: 未更改) | ||
先判断后循环: | 先判断后循环: | ||
− | <syntaxhighlight> | + | <syntaxhighlight lang=pascal> |
while 逻辑表达式 do | while 逻辑表达式 do | ||
语句; | 语句; | ||
Line 12: | Line 14: | ||
在循环体中你必须设法改变表达式的值(即,造成为假的条件),否则,它将是一个死循环: | 在循环体中你必须设法改变表达式的值(即,造成为假的条件),否则,它将是一个死循环: | ||
− | <syntaxhighlight> | + | <syntaxhighlight lang=pascal> |
a := 5; | a := 5; | ||
while a < 6 do | while a < 6 do | ||
Line 21: | Line 23: | ||
通过改变变量,以避免循环: | 通过改变变量,以避免循环: | ||
− | <syntaxhighlight> | + | <syntaxhighlight lang=pascal> |
a := 5; | a := 5; | ||
while a < 6 do | while a < 6 do | ||
Line 33: | Line 35: | ||
{|style=color-backgroud="white" cellspacing="20" | {|style=color-backgroud="white" cellspacing="20" | ||
− | |[[FOR..DO/zh_CN|上一页]] | + | |[[Basic Pascal Tutorial/Chapter 3/FOR..DO/zh_CN|上一页]] |
− | |[[Contents|目录]] | + | |[[Basic Pascal Tutorial/Contents/zh CN|目录]] |
− | |[[REPEAT..UNTIL/zh_CN|下一页]] | + | |[[Basic Pascal Tutorial/Chapter 3/REPEAT..UNTIL/zh_CN|下一页]] |
|} | |} | ||
− | |||
− | |||
− |
Latest revision as of 15:19, 20 August 2022
│
български (bg) │
English (en) │
français (fr) │
日本語 (ja) │
中文(中国大陆) (zh_CN) │
3Db - WHILE..DO循环 (原作者: Tao Yue, 状态: 未更改)
先判断后循环:
while 逻辑表达式 do
语句;
判断逻辑表达式为真,则继续执行循环;直至表达式为假将退出循环。
在循环体中你必须设法改变表达式的值(即,造成为假的条件),否则,它将是一个死循环:
a := 5;
while a < 6 do
writeln (a);
通过改变变量,以避免循环:
a := 5;
while a < 6 do
begin
writeln (a);
a := a + 1
end;
WHILE...DO 称之为先判断后循环,即,在进入循环前,先判断条件是否为真,如果为假,将不会进入循环。
上一页 | 目录 | 下一页 |