diff options
Diffstat (limited to 'files/tr/web/javascript/reference/statements/break/index.html')
-rw-r--r-- | files/tr/web/javascript/reference/statements/break/index.html | 117 |
1 files changed, 0 insertions, 117 deletions
diff --git a/files/tr/web/javascript/reference/statements/break/index.html b/files/tr/web/javascript/reference/statements/break/index.html deleted file mode 100644 index a929634f58..0000000000 --- a/files/tr/web/javascript/reference/statements/break/index.html +++ /dev/null @@ -1,117 +0,0 @@ ---- -title: break -slug: Web/JavaScript/Reference/Statements/break -translation_of: Web/JavaScript/Reference/Statements/break ---- -<div>{{jsSidebar("Statements")}}</div> - -<p>Break ifadesi içinde bulunduğu döngüyü , {{jsxref("Statements/switch", "switch")}}, or {{jsxref("Statements/label", "label")}} ifadelerini sonlandırır ve programın kontrolünü sonlandırılan ifadeyi ardından takip eden ifadeye geçirir.</p> - -<div>{{EmbedInteractiveExample("pages/js/statement-break.html")}}</div> - - - -<h2 id="Syntax">Syntax</h2> - -<pre class="syntaxbox"><code>break [etiket];</code></pre> - -<dl> - <dt><code>etiket</code></dt> - <dd>İsteğe bağlıdır.İfade etiketini tanımlamakta kullanılır. Eğer belirtilen ifade bir döngü ya da {{jsxref("Statements/switch", "switch")}} değilse, mutlaka kullanılması gerekir.</dd> -</dl> - -<h2 id="Description">Description</h2> - -<p>The <code>break</code> statement includes an optional label that allows the program to break out of a labeled statement. The <code>break</code> statement needs to be nested within the referenced label. The labeled statement can be any {{jsxref("Statements/block", "block")}} statement; it does not have to be preceded by a loop statement.</p> - -<h2 id="Examples">Examples</h2> - -<p>The following function has a <code>break</code> statement that terminates the {{jsxref("Statements/while", "while")}} loop when <code>i</code> is 3, and then returns the value 3 * <code>x</code>.</p> - -<pre class="brush:js;highlight:[6];">function testBreak(x) { - var i = 0; - - while (i < 6) { - if (i == 3) { - break; - } - i += 1; - } - - return i * x; -}</pre> - -<p>The following code uses <code>break</code> statements with labeled blocks. A <code>break</code> statement must be nested within any label it references. Notice that <code>inner_block</code> is nested within <code>outer_block</code>.</p> - -<pre class="brush:js;highlight:[1,2,4];">outer_block: { - inner_block: { - console.log('1'); - break outer_block; // breaks out of both inner_block and outer_block - console.log(':-('); // skipped - } - console.log('2'); // skipped -} -</pre> - -<p>The following code also uses <code>break</code> statements with labeled blocks but generates a Syntax Error because its <code>break</code> statement is within <code>block_1</code> but references <code>block_2</code>. A <code>break</code> statement must always be nested within any label it references.</p> - -<pre class="brush:js;highlight:[1,3,6];">block_1: { - console.log('1'); - break block_2; // SyntaxError: label not found -} - -block_2: { - console.log('2'); -} -</pre> - -<h2 id="Specifications">Specifications</h2> - -<table class="standard-table"> - <tbody> - <tr> - <th scope="col">Specification</th> - <th scope="col">Status</th> - <th scope="col">Comment</th> - </tr> - <tr> - <td>{{SpecName('ES1')}}</td> - <td>{{Spec2('ES1')}}</td> - <td>Initial definition. Unlabeled version.</td> - </tr> - <tr> - <td>{{SpecName('ES3')}}</td> - <td>{{Spec2('ES3')}}</td> - <td>Labeled version added.</td> - </tr> - <tr> - <td>{{SpecName('ES5.1', '#sec-12.8', 'Break statement')}}</td> - <td>{{Spec2('ES5.1')}}</td> - <td> </td> - </tr> - <tr> - <td>{{SpecName('ES6', '#sec-break-statement', 'Break statement')}}</td> - <td>{{Spec2('ES6')}}</td> - <td> </td> - </tr> - <tr> - <td>{{SpecName('ESDraft', '#sec-break-statement', 'Break statement')}}</td> - <td>{{Spec2('ESDraft')}}</td> - <td> </td> - </tr> - </tbody> -</table> - -<h2 id="Browser_compatibility">Browser compatibility</h2> - - - -<p>{{Compat("javascript.statements.break")}}</p> - -<h2 id="See_also">See also</h2> - -<ul> - <li>{{jsxref("Statements/continue", "continue")}}</li> - <li>{{jsxref("Statements/label", "label")}}</li> - <li>{{jsxref("Statements/switch", "switch")}}</li> -</ul> |