<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.catglobe.com/index.php?action=history&amp;feed=atom&amp;title=Using_break_to_Exit_a_Loop</id>
	<title>Using break to Exit a Loop - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.catglobe.com/index.php?action=history&amp;feed=atom&amp;title=Using_break_to_Exit_a_Loop"/>
	<link rel="alternate" type="text/html" href="https://wiki.catglobe.com/index.php?title=Using_break_to_Exit_a_Loop&amp;action=history"/>
	<updated>2026-04-19T22:36:56Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>https://wiki.catglobe.com/index.php?title=Using_break_to_Exit_a_Loop&amp;diff=20708&amp;oldid=prev</id>
		<title>Cg_pham at 07:16, 14 December 2011</title>
		<link rel="alternate" type="text/html" href="https://wiki.catglobe.com/index.php?title=Using_break_to_Exit_a_Loop&amp;diff=20708&amp;oldid=prev"/>
		<updated>2011-12-14T07:16:23Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 07:16, 14 December 2011&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:Program_Control_Statements]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:Program_Control_Statements]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;﻿&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;﻿&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;{{HelpFiles}}&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===Using break to Exit a Loop===&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===Using break to Exit a Loop===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key wiki:diff:1.41:old-17231:rev-20708:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Cg_pham</name></author>
	</entry>
	<entry>
		<id>https://wiki.catglobe.com/index.php?title=Using_break_to_Exit_a_Loop&amp;diff=17231&amp;oldid=prev</id>
		<title>Cg_pham at 08:30, 21 March 2011</title>
		<link rel="alternate" type="text/html" href="https://wiki.catglobe.com/index.php?title=Using_break_to_Exit_a_Loop&amp;diff=17231&amp;oldid=prev"/>
		<updated>2011-03-21T08:30:08Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 08:30, 21 March 2011&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;HelpBooks&lt;/del&gt;]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Program_Control_Statements&lt;/ins&gt;]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;﻿&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;﻿&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key wiki:diff:1.41:old-15987:rev-17231:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Cg_pham</name></author>
	</entry>
	<entry>
		<id>https://wiki.catglobe.com/index.php?title=Using_break_to_Exit_a_Loop&amp;diff=15987&amp;oldid=prev</id>
		<title>Catglobe: jrfconvert import</title>
		<link rel="alternate" type="text/html" href="https://wiki.catglobe.com/index.php?title=Using_break_to_Exit_a_Loop&amp;diff=15987&amp;oldid=prev"/>
		<updated>2011-03-07T09:01:30Z</updated>

		<summary type="html">&lt;p&gt;jrfconvert import&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[Category:HelpBooks]]&lt;br /&gt;
﻿&lt;br /&gt;
&lt;br /&gt;
===Using break to Exit a Loop===&lt;br /&gt;
&lt;br /&gt;
It is possible to force an immediate exit from a loop, bypassing any code remaining in the body of the loop and the loop’s conditional test, by using break statement. When a break statement is encountered inside a loop, the loop is terminated, and program control resumes at the next statement following the loop. Here is an example:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;tableintopic&amp;quot; style=&amp;quot;border-collapse: collapse&amp;quot; width=&amp;quot;590&amp;quot; cellpadding=&amp;quot;2&amp;quot; bgcolor=&amp;quot;#C0C0C0&amp;quot;&lt;br /&gt;
|- align=&amp;quot;left&amp;quot; valign=&amp;quot;top&amp;quot;&lt;br /&gt;
| width=&amp;quot;590&amp;quot; bgcolor=&amp;quot;#C0C0C0&amp;quot; |&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
number i = 1;&lt;br /&gt;
&lt;br /&gt;
while (i&amp;amp;lt;10)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
if (i==6) break;&lt;br /&gt;
&lt;br /&gt;
print(i);&lt;br /&gt;
&lt;br /&gt;
i = i + 1;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
print(&amp;quot;Counting completed.&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
The output from the script is shown here:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;tableintopic&amp;quot; style=&amp;quot;border-collapse: collapse&amp;quot; width=&amp;quot;590&amp;quot; cellpadding=&amp;quot;2&amp;quot; bgcolor=&amp;quot;#C0C0C0&amp;quot;&lt;br /&gt;
|- align=&amp;quot;left&amp;quot; valign=&amp;quot;top&amp;quot;&lt;br /&gt;
| width=&amp;quot;590&amp;quot; bgcolor=&amp;quot;#C0C0C0&amp;quot; |&lt;br /&gt;
1&lt;br /&gt;
&lt;br /&gt;
2&lt;br /&gt;
&lt;br /&gt;
3&lt;br /&gt;
&lt;br /&gt;
4&lt;br /&gt;
&lt;br /&gt;
5&lt;br /&gt;
&lt;br /&gt;
Counting completed.&lt;br /&gt;
&lt;br /&gt;
In nested loops, the break statement in the inner loop causes only the termination of that loop. The outer loop is unaffected.&lt;br /&gt;
__NOTOC__&lt;br /&gt;
&amp;lt;!-- imported from file: 270.htm--&amp;gt;&lt;/div&gt;</summary>
		<author><name>Catglobe</name></author>
	</entry>
</feed>