when和while的具体用法,最好带上例子

如题所述

你说的是Basic语言吧,when是用在当...时候,强调时间点(事实上,英语中也是这样),while是用在一段时间(英语也一样),下面举几个例子:
程序:
省略上文
when x=1
then y=2
省略下文(when)
省略上文
while x<=1
then y=2
省略下文
如果是在英文表达环境中,那么:
L open the door and get out when my mother is sleeping 。
当我妈妈正在睡觉的时候我打开门走了出去。
He is watching TV while the game。
比赛进行的时候,他一直都在看电视
温馨提示:答案为网友推荐,仅供参考
第1个回答  2011-03-24
when 条件 then 动作 就是如果那么的意思
while 是循环结构的一种
用法:while(true){syso("hello world!")}
第2个回答  2011-03-25
续性动词,也可以用于非延续性动词
while i was watching tv ,the doorbell rang
i was watching TV when the doorbell rang