📄 stmt.html
字号:
<A NAME="See also"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><B><zrefheader>See also</zrefheader></B></FONT><BR><A NAME="1015950"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph><FONT FACE="courier, couriernew, monospaced size"><A HREF="stmt.html#1081298" >break</A>, <A HREF="stmt.html#1018088" >label</A></FONT></zparagraph></FONT><P><BR><BR><A NAME="1037353"> </A><A NAME="do...while"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="4"><zhead1>do...while</zhead1><HR SIZE="2" NOSHADE></FONT><BR><A NAME="1057761"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph>Executes the specified statements until the test condition evaluates to false. Statements execute at least once. <BR><P><TABLE WIDTH="90%" BORDER="1" CELLPADDING="5" CELLSPACING="0"> <CAPTION></CAPTION><P><FONT FACE=""><B></B></FONT><BR><BR> <TR> <TD VALIGN=TOP><P><A NAME="1057764"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext><I>Implemented in</I></ztabletext></FONT> </TD> <TD VALIGN=TOP><P><A NAME="1057766"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>JavaScript 1.2, NES 3.0</ztabletext></FONT> </TD> </TR> <TR> <TD VALIGN=TOP><P><A NAME="1082045"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>ECMA Version</ztabletext></FONT> </TD> <TD VALIGN=TOP><P><A NAME="1082047"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>ECMA 262, Edition 3</ztabletext></FONT> </TD> </TR></TABLE><P></zparagraph></FONT><P><BR><A NAME="1016010"> </A><A NAME="Syntax"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><B><zrefheader>Syntax</zrefheader></B></FONT><BR><A NAME="1016011"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline>do <br> <I>statements<br></I>while (<I>condition</I>);</zcodeline></FONT><P><BR><A NAME="1016014"> </A><A NAME="Parameters"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><B><zrefheader>Parameters</zrefheader></B></FONT><BR><A NAME="1016015"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph><BR><P><TABLE WIDTH="90%" BORDER="1" CELLPADDING="5" CELLSPACING="0"> <CAPTION></CAPTION><P><FONT FACE=""><B></B></FONT><BR><BR> <TR> <TD VALIGN=TOP><A NAME="1016274"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline>statements</zcodeline></FONT><P> </TD> <TD VALIGN=TOP><P><A NAME="1016322"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Block of statements that is executed at least once and is re-executed each time the condition evaluates to true. </ztabletext></FONT> </TD> </TR> <TR> <TD VALIGN=TOP><A NAME="1016278"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline>condition</zcodeline></FONT><P> </TD> <TD VALIGN=TOP><P><A NAME="1016379"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Evaluated after each pass through the loop. If <FONT FACE="courier, couriernew, monospaced size">condition</FONT> evaluates to true, the statements in the preceding block are re-executed. When <FONT FACE="courier, couriernew, monospaced size">condition</FONT> evaluates to false, control passes to the statement following <FONT FACE="courier, couriernew, monospaced size">do while</FONT>. </ztabletext></FONT> </TD> </TR></TABLE><P></zparagraph></FONT><P><BR><A NAME="1058838"> </A><A NAME="Examples"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><B><zrefheader>Examples</zrefheader></B></FONT><BR><A NAME="1016021"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph>In the following example, the <FONT FACE="courier, couriernew, monospaced size">do</FONT> loop iterates at least once and reiterates until i is no longer less than 5.</zparagraph></FONT><P><A NAME="1016023"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline>do {<br> i+=1;<br> document.write(i);<br>while (i<5);</zcodeline></FONT><P><BR><BR><A NAME="1016648"> </A><A NAME="export"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="4"><zhead1>export</zhead1><HR SIZE="2" NOSHADE></FONT><BR><A NAME="1082357"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph>Allows a signed script to provide properties, functions, and objects to other signed or unsigned scripts.</zparagraph></FONT><P><A NAME="1082415"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph>This feature is not in ECMA 262, Edition 3.<BR><P><TABLE WIDTH="90%" BORDER="1" CELLPADDING="5" CELLSPACING="0"> <CAPTION></CAPTION><P><FONT FACE=""><B></B></FONT><BR><BR> <TR> <TD VALIGN=TOP><P><A NAME="1035840"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext><I>Implemented in</I></ztabletext></FONT> </TD> <TD VALIGN=TOP><P><A NAME="1035842"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>JavaScript 1.2, NES 3.0</ztabletext></FONT> </TD> </TR></TABLE><P></zparagraph></FONT><P><BR><A NAME="1016651"> </A><A NAME="Syntax"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><B><zrefheader>Syntax</zrefheader></B></FONT><BR><A NAME="1016652"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline>export name1, name2, ..., nameN<br>export *</zcodeline></FONT><P><BR><A NAME="1016655"> </A><A NAME="Parameters"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><B><zrefheader>Parameters</zrefheader></B></FONT><BR><A NAME="1016656"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph><BR><P><TABLE WIDTH="90%" BORDER="1" CELLPADDING="5" CELLSPACING="0"> <CAPTION></CAPTION><P><FONT FACE=""><B></B></FONT><BR><BR> <TR> <TD VALIGN=TOP><A NAME="1016852"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline>nameN</zcodeline></FONT><P> </TD> <TD VALIGN=TOP><P><A NAME="1016991"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>List of properties, functions, and objects to be exported.</ztabletext></FONT> </TD> </TR> <TR> <TD VALIGN=TOP><A NAME="1033601"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline>*</zcodeline></FONT><P> </TD> <TD VALIGN=TOP><P><A NAME="1033733"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Exports all properties, functions, and objects from the script.</ztabletext></FONT> </TD> </TR></TABLE><P></zparagraph></FONT><P><BR><A NAME="1016658"> </A><A NAME="Description"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><B><zrefheader>Description</zrefheader></B></FONT><BR><A NAME="1016659"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph>Typically, information in a signed script is available only to scripts signed by the same principals. By exporting properties, functions, or objects, a signed script makes this information available to any script (signed or unsigned). The receiving script uses the companion import statement to access the information.</zparagraph></FONT><P><BR><A NAME="1016663"> </A><A NAME="See also"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><B><zrefheader>See also</zrefheader></B></FONT><BR><A NAME="1016630"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph><A HREF="stmt.html#1082618" >import</A></zparagraph></FONT><P><BR><BR><A NAME="1004804"> </A><A NAME="for"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="4"><zhead1>for</zhead1><HR SIZE="2" NOSHADE></FONT><BR><A NAME="1004805"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph>Creates a loop that consists of three optional expressions, enclosed in parentheses and separated by semicolons, followed by a block of statements executed in the loop.<BR><P><TABLE WIDTH="90%" BORDER="1" CELLPADDING="5" CELLSPACING="0"> <CAPTION></CAPTION><P><FONT FACE=""><B></B></FONT><BR><BR> <TR> <TD VALIGN=TOP><P><A NAME="1035896"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext><I>Implemented in</I></ztabletext></FONT> </TD> <TD VALIGN=TOP><P><A NAME="1041845"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>JavaScript 1.0, NES 2.0</ztabletext></FONT> </TD> </TR> <TR> <TD VALIGN=TOP><P><A NAME="1050127"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext><I>ECMA version</I></ztabletext></FONT> </TD> <TD VALIGN=TOP><P><A NAME="1050129"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>ECMA-262</ztabletext></FONT> </TD> </TR></TABLE><P></zparagraph></FONT><P><BR><A NAME="1004806"> </A><A NAME="Syntax"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><B><zrefheader>Syntax</zrefheader></B></FONT><BR><A NAME="1004807"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline>for ([initial-expression]; [condition]; [increment-expression]) {<br> statements<br>}</zcodeline></FONT><P><BR><A NAME="1005639"> </A><A NAME="Parameters"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><B><zrefheader>Parameters</zrefheader></B></FONT><BR><A NAME="1004808"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph><BR><P><TABLE WIDTH="90%" BORDER="1" CELLPADDING="5" CELLSPACING="0"> <CAPTION></CAPTION><P><FONT FACE=""><B></B></FONT><BR><BR> <TR> <TD VALIGN=TOP><A NAME="1012272"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline>initial-expression</zcodeline></FONT><P> </TD> <TD VALIGN=TOP><P><A NAME="1012381"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Statement or variable declaration. Typically used to initialize a counter variable. This expression may optionally declare new variables with the <FONT FACE="courier, couriernew, monospaced size">var</FONT> keyword. These variables are local to the function, not to the loop.</ztabletext></FONT> </TD> </TR> <TR> <TD VALIGN=TOP><A NAME="1012276"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline>condition</zcodeline></FONT><P> </TD> <TD VALIGN=TOP><P><A NAME="1012418"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Evaluated on each pass through the loop. If this condition evaluates to true, the statements in <FONT FACE="courier, couriernew, monospaced size">statements</FONT> are performed. This conditional test is optional. If omitted, the condition always evaluates to true.</ztabletext></FONT> </TD> </TR> <TR> <TD VALIGN=TOP><A NAME="1012280"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline>increment-expression</zcodeline></FONT><P> </TD> <TD VALIGN=TOP><P><A NAME="1012459"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Generally used to update or increment the counter variable.</ztabletext></FONT> </TD> </TR> <TR> <TD VALIGN=TOP><A NAME="1012284"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline>statements</zcodeline></FONT><P> </TD> <TD VALIGN=TOP><P><A NAME="1012492"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Block of statements that are executed as long as condition evaluates to true. This can be a single statement or multiple statements. Although not required, it is good practice to indent these statements from the beginning of the <FONT FACE="courier, couriernew, monospaced size">for</FONT> statement.</ztabletext></FONT> </TD> </TR>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -