<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>while</title>
	<atom:link href="https://www.aitaocui.cn/tag/261897/feed" rel="self" type="application/rss+xml" />
	<link>https://www.aitaocui.cn</link>
	<description>翡翠玉石爱好者聚集地</description>
	<lastBuildDate>Mon, 28 Nov 2022 13:27:47 +0000</lastBuildDate>
	<language>zh-CN</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.1</generator>

<image>
	<url>https://www.aitaocui.cn/wp-content/uploads/2022/11/taocui.png</url>
	<title>while</title>
	<link>https://www.aitaocui.cn</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>while(循环语句及英文单词)</title>
		<link>https://www.aitaocui.cn/article/374141.html</link>
					<comments>https://www.aitaocui.cn/article/374141.html#respond</comments>
		
		<dc:creator><![CDATA[杜老师]]></dc:creator>
		<pubDate>Mon, 28 Nov 2022 13:27:47 +0000</pubDate>
				<category><![CDATA[知识]]></category>
		<category><![CDATA[while]]></category>
		<guid isPermaLink="false">https://www.aitaocui.cn/?p=374141</guid>

					<description><![CDATA[while是计算机的一种基本循环模式。当满足条件时进入循环，进入循环后，当条件不满足时，跳出循环。while语句的一般表达式为：while（表达式）{循环体}。 典型循环 WHIL...]]></description>
										<content:encoded><![CDATA[</p>
<article>
<p>while是计算机的一种基本循环模式。当满足条件时进入循环，进入循环后，当条件不满足时，跳出循环。while语句的一般表达式为：while（表达式）{循环体}。</p>
</article>
<p><img decoding="async" src="https://www.aitaocui.cn/wp-content/uploads/2022/08/20220828_630b82f00a0ab.png" /></p>
<article>
<h1>典型循环</h1>
<div></div>
<p>WHILE&lt;条件&gt;条件</p>
<p>&lt;语句体&gt;语句体</p>
<p>endwhile</p>
<p>dowhile&lt;条件&gt;条件</p>
<p>&lt;语句体&gt;语句体</p>
<p>loop</p>
<h1>语法</h1>
<p>Pascal</p>
<p>while&lt;条件&gt;do&lt;语句&gt;语句条件</p>
<p>意为当条件符合时，接着做下面的语句；不符合时，退出循环。</p>
<p>C</p>
<p>do&lt;语句&gt;while(&lt;条件&gt;);条件语句</p>
<p>while(&lt;条件&gt;)&lt;语句&gt;;语句条件</p>
<p>C++</p>
<p>while(&lt;条件&gt;)&lt;语句&gt;;语句条件</p>
<p>do&lt;语句&gt;while(&lt;条件&gt;);条件语句</p>
<p>Java</p>
<p>while(&lt;条件&gt;){&lt;语句&gt;}语句条件</p>
<p>do{&lt;语句&gt;}while(&lt;条件&gt;);条件语句</p>
<p>二者的区别是do-while最少会被执行一次。</p>
<p>循环中可以使用continue结束当前循环，回到循环开始处开始下一次循环。也可以用break跳出整个循环。</p>
<p>javascript</p>
<p>while(变量&lt;=结束值){需执行的代码}</p>
<p>while(变量&lt;=结束值){需执行的代码}</p>
<p>注意：除了&lt;=，还可以使用其他的比较运算符。</p>
<p>do&#8230;while</p>
<p>do{需执行的代码}while(变量&lt;=结束值)</p>
<p>do{需执行的代码}while(变量&lt;=结束值)</p>
<p>JavaScript while循环的目的是为了反复执行语句或代码块。</p>
<p>只要指定条件为true，循环就可以一直执行代码块。</p>
<p>注意：do&#8230;while循环是while循环的变种。该循环程序在初次运行时会首先执行一遍其中的代码，然后当指定的条件为true时，它会继续这个循环。所以可以这么说，do&#8230;while循环为执行至少一遍其中的代码，即使条件为false，因为其中的代码执行后才会进行条件验证。</p>
<p>PHP</p>
<p>while循环是php中最简单的循环类型。它和C语言中的while表现得一样。语法如下：</p>
<p>while(expr){statement}</p>
<div></div>
</p>
<h1>使用示例</h1>
<p>C++</p>
</p>
<table style="width:782px">
<colgroup>
<col width="391" />
<col width="391" /></colgroup>
<tr>
<td colspan="1" rowspan="1" style="border-left:1px solid #000000;border-right:1px solid #000000;border-bottom:1px solid #000000;border-top:1px solid #000000;padding-left:7px;padding-right:7px">
<p>1</p>
<p>2</p>
<p>3</p>
<p>4</p>
<p>5</p>
<p>6</p>
<p>7</p>
<p>8</p>
<p>9</p>
</td>
<td colspan="1" rowspan="1" style="border-left:1px solid #000000;border-right:1px solid #000000;border-bottom:1px solid #000000;border-top:1px solid #000000;padding-left:7px;padding-right:7px">
<p>inta=NULL;</p>
<p>while(a&lt;10)</p>
<p>{</p>
<p>a++;//自加</p>
<p>if(a&gt;5)//不等while退出循环，直接判断循环</p>
<p>{</p>
<p>break;//跳出循环</p>
<p>}</p>
<p>}</p>
</td>
</tr>
</table>
<p>结果：结束后a的值为6。</p>
<p>Javascript</p>
<p>下面的例子定义了一个循环程序，这个循环程序的参数i的起始值为0。该程序会反复运行，直到i大于10为止。i的步进值为1。</p>
</p>
<table style="width:782px">
<colgroup>
<col width="391" />
<col width="391" /></colgroup>
<tr>
<td colspan="1" rowspan="1" style="border-left:1px solid #000000;border-right:1px solid #000000;border-bottom:1px solid #000000;border-top:1px solid #000000;padding-left:7px;padding-right:7px">
<p>1</p>
<p>2</p>
<p>3</p>
<p>4</p>
<p>5</p>
<p>6</p>
<p>7</p>
<p>8</p>
<p>9</p>
</td>
<td colspan="1" rowspan="1" style="border-left:1px solid #000000;border-right:1px solid #000000;border-bottom:1px solid #000000;border-top:1px solid #000000;padding-left:7px;padding-right:7px">
<p>&lt;html&gt;</p>
<p>&lt;body&gt;</p>
<p>&lt;scripttype=&quot;text/javascript&quot;&gt;</p>
<p>vari=0while(i&lt;=10)</p>
<p>{document.write(&quot;Thenumberis&quot;+i)</p>
<p>document.write(&quot;&lt;br/&gt;&quot;)i=i+1}</p>
<p>&lt;/script&gt;</p>
<p>&lt;/body&gt;</p>
<p>&lt;/html&gt;</p>
</td>
</tr>
</table>
<p>结果</p>
<p>The number is0</p>
<p>The number is1</p>
<p>The number is2</p>
<p>The number is3</p>
<p>The number is4</p>
<p>The number is5</p>
<p>The number is6</p>
<p>The number is7</p>
<p>The number is8</p>
<p>The number is9</p>
<p>The number is10</p>
<p>PHP</p>
<table style="width:650px">
<colgroup>
<col width="325" />
<col width="325" /></colgroup>
<tr>
<td colspan="1" rowspan="1" style="border-left:1px solid #000000;border-right:1px solid #000000;border-bottom:1px solid #000000;border-top:1px solid #000000;padding-left:7px;padding-right:7px">
<p>1</p>
<p>2</p>
<p>3</p>
<p>4</p>
<p>5</p>
<p>6</p>
<p>7</p>
<p>8</p>
<p>9</p>
<p>10</p>
<p>11</p>
</td>
<td colspan="1" rowspan="1" style="border-left:1px solid #000000;border-right:1px solid #000000;border-bottom:1px solid #000000;border-top:1px solid #000000;padding-left:7px;padding-right:7px">
<p>&lt;?php</p>
<p>$num=1;</p>
<p>$aaa=&quot;10以内的偶数为：&quot;;</p>
<p>while($num&lt;=10){</p>
<p>if($num&lt;=10){</p>
<p>$aaa.=$sum.&quot;&quot;;</p>
<p>}</p>
<p>$sum++;</p>
<p>}</p>
<p>echo$aaa;</p>
<p>?&gt;</p>
</td>
</tr>
</table>
<p>下面两个例子完全一样，都显示数字1到10：</p>
<table style="width:782px">
<colgroup>
<col width="391" />
<col width="391" /></colgroup>
<tr>
<td colspan="1" rowspan="1" style="border-left:1px solid #000000;border-right:1px solid #000000;border-bottom:1px solid #000000;border-top:1px solid #000000;padding-left:7px;padding-right:7px">
<p>1</p>
</td>
<td colspan="1" rowspan="1" style="border-left:1px solid #000000;border-right:1px solid #000000;border-bottom:1px solid #000000;border-top:1px solid #000000;padding-left:7px;padding-right:7px">
<p>&lt;?php/*example1*/$i=1;while($i&lt;=10){echo$i++;/*theprintedvaluewouldbe$ibeforetheincrement(post-increment)*/}/*example2*/$i=1;while($i&lt;=10):print$i;$i++;endwhile;?&gt;</p>
</td>
</tr>
</table>
<p>C#</p>
<table style="width:782px">
<colgroup>
<col width="391" />
<col width="391" /></colgroup>
<tr>
<td colspan="1" rowspan="1" style="border-left:1px solid #000000;border-right:1px solid #000000;border-bottom:1px solid #000000;border-top:1px solid #000000;padding-left:7px;padding-right:7px">
<p>1</p>
<p>2</p>
<p>3</p>
<p>4</p>
<p>5</p>
</td>
<td colspan="1" rowspan="1" style="border-left:1px solid #000000;border-right:1px solid #000000;border-bottom:1px solid #000000;border-top:1px solid #000000;padding-left:7px;padding-right:7px">
<p>inti=1;</p>
<p>while(i&lt;=10)</p>
<p>{</p>
<p>Console.WriteLine(&quot;{0}&quot;，i++);</p>
<p>}</p>
</td>
</tr>
</table>
<p>Java</p>
<p>1</p>
<table style="width:782px">
<colgroup>
<col width="103" />
<col width="679" /></colgroup>
<tr>
<td colspan="1" rowspan="1" style="border-left:1px solid #000000;border-right:1px solid #000000;border-bottom:1px solid #000000;border-top:1px solid #000000;padding-left:7px;padding-right:7px">
<p>1</p>
<p>2</p>
<p>3</p>
</td>
<td colspan="1" rowspan="1" style="border-left:1px solid #000000;border-right:1px solid #000000;border-bottom:1px solid #000000;border-top:1px solid #000000;padding-left:7px;padding-right:7px">
<p>while(true)</p>
<p>{i++;</p>
<p>}/i无限累加，死循环/</p>
</td>
</tr>
</table>
<p>2</p>
<table style="width:782px">
<colgroup>
<col width="391" />
<col width="391" /></colgroup>
<tr>
<td colspan="1" rowspan="1" style="border-left:1px solid #000000;border-right:1px solid #000000;border-bottom:1px solid #000000;border-top:1px solid #000000;padding-left:7px;padding-right:7px">
<p>1</p>
</td>
<td colspan="1" rowspan="1" style="border-left:1px solid #000000;border-right:1px solid #000000;border-bottom:1px solid #000000;border-top:1px solid #000000;padding-left:7px;padding-right:7px">
<p>do{i++;}while(i&lt;60)/在i小于60的情况下进行累加/</p>
</td>
</tr>
</table>
<p>Basic</p>
<p>DimiAsInteger</p>
<p>i=1</p>
<p>DoWhilei&lt;=5</p>
<p>Printi</p>
<p>i=i+1</p>
<p>Loop</p>
<p>向屏幕输出从1到5的正整数</p>
<p>AS</p>
<table style="width:782px">
<colgroup>
<col width="391" />
<col width="391" /></colgroup>
<tr>
<td colspan="1" rowspan="1" style="border-left:1px solid #000000;border-right:1px solid #000000;border-bottom:1px solid #000000;border-top:1px solid #000000;padding-left:7px;padding-right:7px">
<p>1</p>
<p>2</p>
<p>3</p>
<p>4</p>
<p>5</p>
<p>6</p>
</td>
<td colspan="1" rowspan="1" style="border-left:1px solid #000000;border-right:1px solid #000000;border-bottom:1px solid #000000;border-top:1px solid #000000;padding-left:7px;padding-right:7px">
<p>vari=1;</p>
<p>while(i&lt;=1000)</p>
<p>{</p>
<p>i++;</p>
<p>}</p>
<p>trace(i)</p>
</td>
</tr>
</table>
<p>Pascal</p>
<p>k:=10;</p>
<p>WHILEk&gt;0DOBEGINWriteln(k);</p>
<p>k:=k-1END;</p>
<p>从10到1倒序输入</p>
<h1>英语</h1>
<h2 id="a-9e2cade4">释义</h2>
<p>1.when和while在引导状语从句时，都可表示“当……的时候”。如</p>
<p>Doctor Smith called when / while we were preparing dinner．</p>
<p>当我们正在做饭的时候，史密斯医生来访了。</p>
<p>While I was in Shanghai， I met with the pop star．</p>
<p>当我在上海时，碰巧遇到了那位流行歌星。</p>
<p>【注意】</p>
<p>(1)when表示“当……的时候”，从句中既可以用延续性动词，表示状态或时间段，也可以用非延续性动词，表示动作或时间点；while表示“当……的时候”、“在……期间”，从句中只能用延续性动词，表示状态或时间段。</p>
<p>例如：</p>
<p>It was snowing when we arrived at the station.</p>
<p>When he came in， we all stood up， smiling．</p>
<p>I was very fat when / while I was a child．</p>
<p>When / While she was typing， someone knocked at the door．</p>
<p>(2)在when或while所引导的状语从句中，如果从句的主语和主句的主语相同，且动词又是be动词时，从句的主语和be动词往往可以省略。</p>
<p>2.when和while都可以表示“尽管、虽然”，但when经常指描述的事实或结果事与愿违或出人意料，而while在语气上含有让步之意。例如：</p>
<p>The boy was watching TV when he should have gone to bed．</p>
<p>虽然那孩子该睡觉了，但他还在看电视。</p>
<p>The old couple prefer walking when they might take a taxi．</p>
<p>尽管可以坐出租车，那对老夫妇更愿意步行。</p>
<p>While I accept that he is not perfect， I do actually like the person．</p>
<p>尽管我承认他并不完美，但我确实真地喜欢他这个人。</p>
<p>While he loves his students， he is very strict with them．</p>
<p>虽然他爱他的学生，但对他们的要求也很严格。</p>
<p>while的其它含义和用法：</p>
<p>(1)然而，可是</p>
<p>I like coffee， while my sister likes tea．</p>
<p>我喜欢咖啡，而我姐姐喜欢喝茶。</p>
<p>I was preparing for the exam while they were chatting．</p>
<p>我在准备考试， 可他们却在闲聊。</p>
<p>(2)只要</p>
<p>While there is water， there is hope of life．</p>
<p>只要有水，就有生存的希望。</p>
<p>I’ll offer help to those poor children while I’m alive．</p>
<p>只要我活着， 就要帮助那些贫困的孩子。</p>
<h2 id="a-c60d8d64">时态标志词</h2>
<p>when和while引导的句子可以作过去进行时的时间状语，区别在于：when引导的时间状语从句可以接一段时间或者一个具体的时间点while引导的时间状语从句只能接一个时间点。如：</p>
<p>通常用在事情同时发生的情况，主句和从句都用过去进行时</p>
<p>Mother was cooking the meal while i was doing my homework.</p>
<p>当妈妈在做饭的时候，我正在做功课。</p>
<h2 id="a-2cae330e">表示同时</h2>
<p>表示而&#8230;的意味时，主句和从句的时态是一致的，即可以都是一般现在时，又可以都是一般过去时，如：</p>
<p>I like playing football while Jim likes playing basketball.</p>
<p>我喜欢踢足球，然而吉姆喜欢打篮球。</p>
<p>Yesterday my parents went to the cinema while I stayed at home.</p>
<p>昨天爸爸，妈妈去看电影了，而我呆在家里在。</p>
</article>
<div class="mt-3 mb-3" style="max-width: 770px;height: auto;">
                                    </div>
<div class="mt-3 mb-3" style="max-width: 770px;height: auto;">
                                    </div>
<div class="mt-3 mb-3" style="max-width: 770px;height: auto;">
                                    </div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.aitaocui.cn/article/374141.html/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
