diff options
author | Florian Dieminger <me@fiji-flo.de> | 2021-02-11 18:24:59 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-11 18:24:59 +0100 |
commit | 772b3cc462ebbd939d77fbdc35173b7c9bb5670c (patch) | |
tree | a5ccab6bafbf375a8f57bdb406878db630329fe0 /files/ja/web/javascript/guide/loop_statements/while_statement/index.html | |
parent | aaeeb9abf350ff53bc52223c6a2f6a15d755ae07 (diff) | |
parent | 9368f65a6c94ddbf6bfe9f4f1f27f166b2e2129f (diff) | |
download | translated-content-772b3cc462ebbd939d77fbdc35173b7c9bb5670c.tar.gz translated-content-772b3cc462ebbd939d77fbdc35173b7c9bb5670c.tar.bz2 translated-content-772b3cc462ebbd939d77fbdc35173b7c9bb5670c.zip |
Merge pull request #30 from fiji-flo/unslugging-ja
Unslugging ja
Diffstat (limited to 'files/ja/web/javascript/guide/loop_statements/while_statement/index.html')
-rw-r--r-- | files/ja/web/javascript/guide/loop_statements/while_statement/index.html | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/files/ja/web/javascript/guide/loop_statements/while_statement/index.html b/files/ja/web/javascript/guide/loop_statements/while_statement/index.html deleted file mode 100644 index 77fd191f75..0000000000 --- a/files/ja/web/javascript/guide/loop_statements/while_statement/index.html +++ /dev/null @@ -1,35 +0,0 @@ ---- -title: while 文 -slug: Web/JavaScript/Guide/Loop_Statements/while_Statement ---- -<h3 id="while_.E6.96.87" name="while_.E6.96.87">while 文</h3> -<p><code>while</code> 文は、指定した条件が true に評価される限り文を実行します。<code>while</code> 文は次のように使用します。</p> -<pre class="eval">while (condition) - statement -</pre> -<p>条件が false になるとループ内の <code>statement</code> の実行が停止し、ループの後に続く文にコントロールが渡されます。</p> -<p>ループの <code>statement</code> を実行する前に条件がテストされます。条件が true を返すと <code>statement</code> が実行され、再び条件がテストされます。条件が false を返すと、実行が停止され、<code>while</code> の後に続く文にコントロールが渡されます。</p> -<p>複数の文を実行するにはブロック文 ({ ... }) を用いて文をグループ化してください。</p> -<p><strong>例 1</strong><br> - 次の <code>while</code> ループでは <code>n</code> が 3 より小さい限り反復されます。</p> -<pre class="eval">n = 0; -x = 0; -while (n < 3) { - n++; - x += n; -} -</pre> -<p>それぞれの反復で、ループは <code>n</code> をインクリメントし、その値を <code>x</code> に加えています。その結果、<code>x</code> と <code>n</code> は次の値をとります。</p> -<ul> - <li>第 1 段階終了後:<code>n</code> = 1、<code>x</code> = 1</li> - <li>第 2 段階終了後:<code>n</code> = 2、<code>x</code> = 3</li> - <li>第 3 段階終了後:<code>n</code> = 3、<code>x</code> = 6</li> -</ul> -<p>第 3 段階が完了すると条件 <code>n</code> < 3 が true ではなくなっているため、ループは終了します。</p> -<p><strong>例 2</strong><br> - 無限ループは避けてください。ループの条件が最終的には false になることを確認してください。そうしないとループが終了しなくなります。次の <code>while</code> ループ内の文は永久に実行されます。条件が決して false にならないためです。</p> -<pre class="eval">while (true) { - alert("Hello, world"); -} -</pre> -<p>{{ PreviousNext("JavaScript/Guide/Loop_Statements/do...while_Statement", "JavaScript/Guide/Loop_Statements/label_Statement") }}</p> |