<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://learn.cemetech.net/index.php?action=history&amp;feed=atom&amp;title=TI-BASIC%3ASK%3ALoops</id>
	<title>TI-BASIC:SK:Loops - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://learn.cemetech.net/index.php?action=history&amp;feed=atom&amp;title=TI-BASIC%3ASK%3ALoops"/>
	<link rel="alternate" type="text/html" href="http://learn.cemetech.net/index.php?title=TI-BASIC:SK:Loops&amp;action=history"/>
	<updated>2026-05-28T09:03:57Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.3</generator>
	<entry>
		<id>http://learn.cemetech.net/index.php?title=TI-BASIC:SK:Loops&amp;diff=1698&amp;oldid=prev</id>
		<title>Maintenance script: Automated internal link correction</title>
		<link rel="alternate" type="text/html" href="http://learn.cemetech.net/index.php?title=TI-BASIC:SK:Loops&amp;diff=1698&amp;oldid=prev"/>
		<updated>2016-02-25T00:54:19Z</updated>

		<summary type="html">&lt;p&gt;Automated internal link correction&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 00:54, 25 February 2016&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-l91&quot;&gt;Line 91:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 91:&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;{{Template:TI-BASIC:Next-prev&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;{{Template:TI-BASIC:Next-prev&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;|prevpage = &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;sk&lt;/del&gt;:&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;labels&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;|prevpage = &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;TI-BASIC&lt;/ins&gt;:&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;SK:Labels&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;|prevtitle = Labels&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;|prevtitle = Labels&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;|tocpage = &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;starter&lt;/del&gt;-&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;kit&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;|tocpage = &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;TI&lt;/ins&gt;-&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;BASIC:Starter_Kit&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;|toctitle = Table of Contents&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;|toctitle = Table of Contents&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;|nextpage = &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;sk&lt;/del&gt;:&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;ans&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;|nextpage = &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;TI-BASIC&lt;/ins&gt;:&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;SK:Ans&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;|nexttitle = Ans}}[[Category:TI-BASIC]]&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;|nexttitle = Ans}}[[Category:TI-BASIC]]&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;[[Category:TIBD]]&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:TIBD]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Maintenance script</name></author>
	</entry>
	<entry>
		<id>http://learn.cemetech.net/index.php?title=TI-BASIC:SK:Loops&amp;diff=1141&amp;oldid=prev</id>
		<title>Maintenance script: Initial automated import</title>
		<link rel="alternate" type="text/html" href="http://learn.cemetech.net/index.php?title=TI-BASIC:SK:Loops&amp;diff=1141&amp;oldid=prev"/>
		<updated>2016-02-24T18:36:46Z</updated>

		<summary type="html">&lt;p&gt;Initial automated import&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Loops are a type of control structure used to repeat a block of code several times. Typically, there are two kinds of loops in programs:&lt;br /&gt;
* A loop that repeats until a condition is satisfied&lt;br /&gt;
* A loop that repeats a fixed number of times&lt;br /&gt;
In TI-Basic, the first kind of loop is created with the [[TI-BASIC:While|While]] and [[TI-BASIC:Repeat|Repeat]] commands, and the second kind is created with the [[TI-BASIC:For|For(]] command.&lt;br /&gt;
&lt;br /&gt;
= While and Repeat =&lt;br /&gt;
&lt;br /&gt;
The syntax for these two loops is identical:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
 :While (condition)&lt;br /&gt;
 :&lt;br /&gt;
 	...&lt;br /&gt;
 :&lt;br /&gt;
 :End&lt;br /&gt;
&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
 :Repeat (condition)&lt;br /&gt;
 :&lt;br /&gt;
 	...&lt;br /&gt;
 :&lt;br /&gt;
 :End&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In practice, however, they are different. The code inside a While loop will keep repeating as long as the condition is true (&amp;quot;do this &amp;#039;&amp;#039;while&amp;#039;&amp;#039; the condition is true&amp;quot;), and exit as soon as the condition is false. The code inside a Repeat loop will keep repeating until the condition becomes true (&amp;quot;&amp;#039;&amp;#039;Repeat&amp;#039;&amp;#039; this &amp;#039;&amp;#039;until&amp;#039;&amp;#039; the condition is true&amp;quot;). So a loop with While will have the opposite condition of the same loop with Repeat.&lt;br /&gt;
&lt;br /&gt;
There is another subtle difference. The While and For( loops are pre-test loops, which means the condition is checked before you enter the loop. If the condition is false, the loop is skipped entirely. However, the Repeat loop is a post-test loop as the loop is done at least once no matter what. The condition is only checked after a cycle is completed.&lt;br /&gt;
&lt;br /&gt;
= The For( Loop =&lt;br /&gt;
&lt;br /&gt;
The [[TI-BASIC:For|For(]] loop is probably the most complicated command we&amp;#039;ve covered so far. Its syntax:&lt;br /&gt;
&lt;br /&gt;
 :For(variable,start,end,step&lt;br /&gt;
 :&lt;br /&gt;
 :End&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This loop will be repeated once for every value of &amp;#039;&amp;#039;variable&amp;#039;&amp;#039; between &amp;#039;&amp;#039;start&amp;#039;&amp;#039; and &amp;#039;&amp;#039;end&amp;#039;&amp;#039;, increasing it by &amp;#039;&amp;#039;step&amp;#039;&amp;#039; each time. For example, For(A,1,10,2) will be repeated once with A=1, then with A=3, then with A=5, then with A=7, and then with A=9 (then the loop stops, because the next value -- 11 -- is greater than the end value of 10).&lt;br /&gt;
&lt;br /&gt;
By default, the step size is 1, so you don&amp;#039;t have to include the step if you want it to be 1. For example, this loop will display the numbers 1 through 10, in order:&lt;br /&gt;
&lt;br /&gt;
 :For(A,1,10)&lt;br /&gt;
 :Disp A&lt;br /&gt;
 :End&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can also have a negative step size: in that case, the ending value should be less than the starting value, and the value of the variable will decrease each time. For example, this loop will display the same numbers 1 through 10, but in reverse order:&lt;br /&gt;
&lt;br /&gt;
 :For(A,10,1,-1)&lt;br /&gt;
 :Disp A&lt;br /&gt;
 :End&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Some Common Loops =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;float:right; width: 15em; padding: 0 1em; margin: 1em 0 1em 1em; border: solid #888888 1px; background-color: #FFFFFF;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Input validation&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Asking repeatedly is not the only way to make sure that input is valid; you might also exit the program if the input is bad, or find a way to interpret bad input as good. &lt;br /&gt;
&lt;br /&gt;
These methods are discussed in more depth in the [[TI-BASIC:Validation|Validation]] tutorial.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One way to use a Repeat loop is to make sure that input is valid. For example:&lt;br /&gt;
&lt;br /&gt;
 :Repeat X&amp;gt;0&lt;br /&gt;
 :Disp &amp;quot;ENTER A POSITIVE&amp;quot;&lt;br /&gt;
 :Input &amp;quot;NUMBER:&amp;quot;,X&lt;br /&gt;
 :End&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This program will ask for a positive number in X. After that, the condition &amp;quot;X&amp;gt;0&amp;quot; will be checked -- if X wasn&amp;#039;t positive, the condition will be false, and the loop will be repeated. So the program will keep asking for a positive number until a positive number is actually entered. This might be useful if your program will not work with negative numbers. &lt;br /&gt;
&lt;br /&gt;
The simplest kind of Repeat or While loop is the infinite loop. This can be done by making Repeat&amp;#039;s condition be 0 (false), or While&amp;#039;s condition be 1 (true). In either case, the loop will keep going forever.&lt;br /&gt;
&lt;br /&gt;
Finally, For( loops have an unusual use to create delays. For example:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 :For(X,1,100)&lt;br /&gt;
 :End&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This code doesn&amp;#039;t actually do anything, but repeating the loop 100 times takes some time. This could be useful when you want to pause for a certain time (say, a few seconds) on a screen before displaying the next screen. &lt;br /&gt;
&lt;br /&gt;
Later in this tutorial, you&amp;#039;ll learn about the [[TI-BASIC:Rand|Rand]] command, which can be used as an alternative to For( in creating delays.&lt;br /&gt;
&lt;br /&gt;
{{Template:TI-BASIC:Next-prev&lt;br /&gt;
|prevpage = sk:labels&lt;br /&gt;
|prevtitle = Labels&lt;br /&gt;
|tocpage = starter-kit&lt;br /&gt;
|toctitle = Table of Contents&lt;br /&gt;
|nextpage = sk:ans&lt;br /&gt;
|nexttitle = Ans}}[[Category:TI-BASIC]]&lt;br /&gt;
[[Category:TIBD]]&lt;/div&gt;</summary>
		<author><name>Maintenance script</name></author>
	</entry>
</feed>