<?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%3AOptimize_Variables</id>
	<title>TI-BASIC:Optimize Variables - 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%3AOptimize_Variables"/>
	<link rel="alternate" type="text/html" href="http://learn.cemetech.net/index.php?title=TI-BASIC:Optimize_Variables&amp;action=history"/>
	<updated>2026-04-20T15:45:07Z</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:Optimize_Variables&amp;diff=1036&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:Optimize_Variables&amp;diff=1036&amp;oldid=prev"/>
		<updated>2016-02-24T18:31:20Z</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;Although it is common to initialize variables for planned use, you should avoid initializing variables that you don&amp;#039;t need or that are initialized further down in the program. The reason is because storing to variables really slows a program down (especially inside loops) and there is no point in initializing a variable twice.&lt;br /&gt;
&lt;br /&gt;
 :2→A&lt;br /&gt;
 :If B&lt;br /&gt;
 :Then&lt;br /&gt;
 :2→A&lt;br /&gt;
 :Else&lt;br /&gt;
 :-2→A&lt;br /&gt;
 :End&lt;br /&gt;
 can be&lt;br /&gt;
 :If B&lt;br /&gt;
 :Then&lt;br /&gt;
 :2→A&lt;br /&gt;
 :Else&lt;br /&gt;
 :-2→A&lt;br /&gt;
 :End&lt;br /&gt;
&lt;br /&gt;
When a number is used many times in a program, you should store it to a variable and then just call the variable instead of writing it out every time. This also applies to text that should be put in a string.&lt;br /&gt;
&lt;br /&gt;
 :Disp &amp;quot;Hello&lt;br /&gt;
 :Disp &amp;quot;Hello&lt;br /&gt;
 :Disp &amp;quot;Hello&lt;br /&gt;
 can be&lt;br /&gt;
 :&amp;quot;Hello→Str1&lt;br /&gt;
 Disp Str1,Str1,Str1&lt;br /&gt;
&lt;br /&gt;
You can also put common variables or expressions in a string variable and then use the [[TI-BASIC:Expr|Expr(]] command to reference them. This can be used in conjunction with other variable commands. This also gives you more variables to use.&lt;br /&gt;
&lt;br /&gt;
 :Disp 5int(B/7&lt;br /&gt;
 :Disp 5int(B/7&lt;br /&gt;
 can be&lt;br /&gt;
 :&amp;quot;5int(B/7→Str1&lt;br /&gt;
 :Disp expr(Str1&lt;br /&gt;
 :Disp expr(Str1&lt;br /&gt;
&lt;br /&gt;
You should reuse variables that have no specific function or that don&amp;#039;t need to be saved.&lt;br /&gt;
&lt;br /&gt;
 :For(X,1,100&lt;br /&gt;
 :End&lt;br /&gt;
 :For(Y,1,50&lt;br /&gt;
 :End&lt;br /&gt;
 can be&lt;br /&gt;
 :For(X,1,100&lt;br /&gt;
 :End&lt;br /&gt;
 :For(X,1,50&lt;br /&gt;
 :End&lt;br /&gt;
&lt;br /&gt;
When storing the same large number in two or more variables, you should store the large number in the first variable and then store the first variable into the rest of the variables.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 :7112→A&lt;br /&gt;
 :7112→B&lt;br /&gt;
 :7112→C&lt;br /&gt;
 can be&lt;br /&gt;
 :7112→A&lt;br /&gt;
 :A→B&lt;br /&gt;
 :A→C&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When calculating several repetitive trigonometric or other math functions in a program, it is sometimes faster to just store the values in a list and recall the values when needed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 :For(A,0,10&lt;br /&gt;
 :Text(6A+1,1,10cos(A&lt;br /&gt;
 :End&lt;br /&gt;
 can be&lt;br /&gt;
 :10cos(seq(A,A,0,10→L1&lt;br /&gt;
 :For(A,0,10&lt;br /&gt;
 :Text(6A+1,1,L1(A&lt;br /&gt;
 :End&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Matrices are faster than lists, so you should use them instead, especially if you have 2 lists to store coordinates:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 :Pxl-Off(L1(I),L2(I&lt;br /&gt;
 can be&lt;br /&gt;
 :Pxl-Off([A](1,I),[A](2,I&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
While this is much larger, it is also faster.[[Category:TI-BASIC]]&lt;br /&gt;
[[Category:TIBD]]&lt;/div&gt;</summary>
		<author><name>Maintenance script</name></author>
	</entry>
</feed>