

<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.zeroy.com/index.php?action=history&amp;feed=atom&amp;title=IFs%2C_Loops_%26_Logic</id>
	<title>IFs, Loops &amp; Logic - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.zeroy.com/index.php?action=history&amp;feed=atom&amp;title=IFs%2C_Loops_%26_Logic"/>
	<link rel="alternate" type="text/html" href="https://wiki.zeroy.com/index.php?title=IFs,_Loops_%26_Logic&amp;action=history"/>
	<updated>2026-04-30T19:48:42Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>https://wiki.zeroy.com/index.php?title=IFs,_Loops_%26_Logic&amp;diff=5682&amp;oldid=prev</id>
		<title>CoDEmanX at 18:35, 28 July 2009</title>
		<link rel="alternate" type="text/html" href="https://wiki.zeroy.com/index.php?title=IFs,_Loops_%26_Logic&amp;diff=5682&amp;oldid=prev"/>
		<updated>2009-07-28T18:35:27Z</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 18:35, 28 July 2009&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;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;== [[IFs, Loops &amp;amp; Logic]] ==&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;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;{{Note|This section will go into a little more detail of how to use &#039;if&#039; statements and loops.}}&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; 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;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Image:Nutshell.png]] This section will go into a little more detail of how to use &#039;if&#039; statements and loops.&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;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;== IFs, Loops &amp;amp; Logic ==&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;An &amp;#039;if&amp;#039; statement is used to verify whether some data satisfies certain conditions, and then to execute code depending on the outcome.&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;An &amp;#039;if&amp;#039; statement is used to verify whether some data satisfies certain conditions, and then to execute code depending on the outcome.&lt;/div&gt;&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-l157&quot;&gt;Line 157:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 157:&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;- if var1 is equal to var2, break out of the 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;- if var1 is equal to var2, break out of the loop&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;- else continue the 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;- else continue the loop&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&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;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&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;[[Category:Call of Duty]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&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;[[Category:Scripting]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>CoDEmanX</name></author>
	</entry>
	<entry>
		<id>https://wiki.zeroy.com/index.php?title=IFs,_Loops_%26_Logic&amp;diff=1842&amp;oldid=prev</id>
		<title>Novemberdobby at 23:38, 23 October 2008</title>
		<link rel="alternate" type="text/html" href="https://wiki.zeroy.com/index.php?title=IFs,_Loops_%26_Logic&amp;diff=1842&amp;oldid=prev"/>
		<updated>2008-10-23T23:38:53Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;a href=&quot;https://wiki.zeroy.com/index.php?title=IFs,_Loops_%26_Logic&amp;amp;diff=1842&amp;amp;oldid=492&quot;&gt;Show changes&lt;/a&gt;</summary>
		<author><name>Novemberdobby</name></author>
	</entry>
	<entry>
		<id>https://wiki.zeroy.com/index.php?title=IFs,_Loops_%26_Logic&amp;diff=492&amp;oldid=prev</id>
		<title>Zeroy: New page: == IFs, Loops &amp; Logic ==  Image:Nutshell.png This section is to go into a little more detail of how to use statements such as If and different loops.  An &#039;If&#039; statement is used to ...</title>
		<link rel="alternate" type="text/html" href="https://wiki.zeroy.com/index.php?title=IFs,_Loops_%26_Logic&amp;diff=492&amp;oldid=prev"/>
		<updated>2008-10-15T16:53:22Z</updated>

		<summary type="html">&lt;p&gt;New page: == &lt;a href=&quot;/index.php?title=IFs,_Loops_%26_Logic&quot; title=&quot;IFs, Loops &amp;amp; Logic&quot;&gt;IFs, Loops &amp;amp; Logic&lt;/a&gt; ==  &lt;a href=&quot;/index.php?title=File:Nutshell.png&quot; title=&quot;File:Nutshell.png&quot;&gt;Image:Nutshell.png&lt;/a&gt; This section is to go into a little more detail of how to use statements such as If and different loops.  An &amp;#039;If&amp;#039; statement is used to ...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== [[IFs, Loops &amp;amp; Logic]] ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Nutshell.png]] This section is to go into a little more detail of how to use statements such as If and different loops.&lt;br /&gt;
&lt;br /&gt;
An &amp;#039;If&amp;#039; statement is used to compare data and decide what is done after the data is compared.&lt;br /&gt;
&lt;br /&gt;
To go into detail in this section, It is required you know of &amp;#039;Logic&amp;#039; and the operators used to compare data.&lt;br /&gt;
&lt;br /&gt;
So...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
== :: Equal To&lt;br /&gt;
!= :: Not Equal To&lt;br /&gt;
!  :: Negation (Not)&lt;br /&gt;
&amp;lt;  :: Less than&lt;br /&gt;
&amp;gt;  :: Greater than&lt;br /&gt;
&amp;lt;= :: Less or Equal to&lt;br /&gt;
&amp;gt;= :: Greater or Equal to&lt;br /&gt;
&amp;amp;&amp;amp; :: And&lt;br /&gt;
|| :: Or&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Ok, now we have some operators, lets get started on the &amp;#039;If&amp;#039; statement.&lt;br /&gt;
&lt;br /&gt;
An &amp;#039;If&amp;#039; statement, requires a minimum of one arguement and usually one operator.&lt;br /&gt;
&lt;br /&gt;
Here are some examples...&lt;br /&gt;
&lt;br /&gt;
 If(variable) // If variable is true&lt;br /&gt;
 If(!variable) // If variable is not true&lt;br /&gt;
 If(variable1 == variable2) // If variable1 is equal to variable2&lt;br /&gt;
 If(variable1 != variable2) // If variable1 is not equal to variable2&lt;br /&gt;
 If(integer1 &amp;lt; integer2) // If integer1 is less than integer2&lt;br /&gt;
 If(integer1 &amp;gt; integer2) // If integer1 is greater than integer2&lt;br /&gt;
 If(integer1 &amp;lt;= integer2) // If integer1 is less than or equal to integer2&lt;br /&gt;
 If(integer1 &amp;gt;= integer2) // If integer1 is greater or equal to integer2&lt;br /&gt;
 If((var1 == var2) &amp;amp;&amp;amp; (var3 != var4)) // If var1 is equal to var2 AND var3 is not equal to var4&lt;br /&gt;
 If((int1 &amp;gt; int2) || (var1 == var2)) // If int1 is greater than int2 OR var1 is equal to var2&lt;br /&gt;
&lt;br /&gt;
To use an If statement to determine the movement of the script, you need to use the arguements to move the script in certain directions...&lt;br /&gt;
&lt;br /&gt;
 If(var1 == var2)&lt;br /&gt;
 {&lt;br /&gt;
   // If statement is true, do this code&lt;br /&gt;
 }&lt;br /&gt;
 // more code here&lt;br /&gt;
&lt;br /&gt;
If the statement above is true, the code inside the curly brackets is processed, if it is not true, the code inside the brackets are skipped.&lt;br /&gt;
&lt;br /&gt;
Whether or not the statement is true, the code outside of the brackets is going to be processed. If this is not what you want, you need to use &amp;quot;Else&amp;quot; after the statement, for example...&lt;br /&gt;
&lt;br /&gt;
 If(var1 == var2)&lt;br /&gt;
 {&lt;br /&gt;
   // If true&lt;br /&gt;
 }&lt;br /&gt;
 Else&lt;br /&gt;
 {&lt;br /&gt;
   // If False&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
You can also use an &amp;quot;Else If&amp;quot; in the statement. This is used in a scenario where you want to check multiple comparisons.&lt;br /&gt;
&lt;br /&gt;
 if(var1 == var2)&lt;br /&gt;
 {&lt;br /&gt;
   // If above arguement is true&lt;br /&gt;
 }&lt;br /&gt;
 Else if(var1 == var3)&lt;br /&gt;
 {&lt;br /&gt;
   // If first arguement is false, but second is true.&lt;br /&gt;
 }&lt;br /&gt;
 Else&lt;br /&gt;
 {&lt;br /&gt;
   // If all arguements are false&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Thats the basics of If&amp;#039;s, so let move to Loops.&lt;br /&gt;
&lt;br /&gt;
Loops come in different forms...&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;While&amp;#039;&amp;#039;&amp;#039; :: A while loop is a loop that keeps looping WHILE the arguement is true.&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;For&amp;#039;&amp;#039;&amp;#039; :: A for loop is a loop that loops a set amount of times&lt;br /&gt;
&lt;br /&gt;
To use a while loop, an arguement is needed &amp;quot;while(arguement);&amp;quot;&lt;br /&gt;
Often, this loop is used for infinite loops. An infinite loop is a loop that loops forever. This is done using the arguement of 1 or true (1 is the integer of true)&lt;br /&gt;
&lt;br /&gt;
 while(1)&lt;br /&gt;
 while(true)&lt;br /&gt;
&lt;br /&gt;
A while loop can also be used as a normal loop that loops while the arguement is true, when the arguement becomes false the loop exits automatically.&lt;br /&gt;
&lt;br /&gt;
 int = 0;&lt;br /&gt;
&lt;br /&gt;
 while(int &amp;lt; 10)&lt;br /&gt;
 {&lt;br /&gt;
  wait 1;&lt;br /&gt;
  int++;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The above code will loop while &amp;#039;int&amp;#039; is less than 10. The loop waits 1 second, and then the loop increments &amp;#039;int&amp;#039;. Once &amp;#039;int&amp;#039; is not less than 10, the loop breaks.&lt;br /&gt;
&lt;br /&gt;
The same applies for FOR loops.&lt;br /&gt;
&lt;br /&gt;
An FOR loop requires 3 arguements.&lt;br /&gt;
&lt;br /&gt;
for(declare;while;do)&lt;br /&gt;
&lt;br /&gt;
Declare is the section which declares a variable for the loop to use. &lt;br /&gt;
&lt;br /&gt;
While is what determines when the loop breaks&lt;br /&gt;
&lt;br /&gt;
Do is what the loop should do after each loop.&lt;br /&gt;
&lt;br /&gt;
A common FOR loop looks like this...&lt;br /&gt;
&lt;br /&gt;
 for(i=0;i&amp;lt;int;i++)&lt;br /&gt;
&lt;br /&gt;
The above code is read, &amp;quot;&amp;#039;i&amp;#039; is equal to 0, while &amp;#039;i&amp;#039; is less than &amp;#039;int&amp;#039;, add 1 to i.&lt;br /&gt;
Lets use the code, and replace int...&lt;br /&gt;
&lt;br /&gt;
 for(i=0;i&amp;lt;10;i++)&lt;br /&gt;
 {&lt;br /&gt;
 wait 1;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
This is the sequence of events...&lt;br /&gt;
&lt;br /&gt;
- &amp;#039;i&amp;#039; = 0&lt;br /&gt;
- loop check &amp;quot;while&amp;quot; (if i is less than 10, continue)&lt;br /&gt;
- perform code (wait 1;)&lt;br /&gt;
- increment &amp;#039;i&amp;#039; (i++)&lt;br /&gt;
- &amp;#039;i&amp;#039; = 1&lt;br /&gt;
- etc.&lt;br /&gt;
&lt;br /&gt;
The FOR loop can also be used as an &amp;quot;infinite loop&amp;quot; using the &amp;quot;forever loop&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 for(;;)&lt;br /&gt;
&lt;br /&gt;
The above will simply keep repeating the code until manual stopped.&lt;br /&gt;
&lt;br /&gt;
The problem with infinite loops is they give an error if you do not allow the loop to take a breath.&lt;br /&gt;
&lt;br /&gt;
Infinite loops require a wait statement. If you get an &amp;quot;Infinite Loop&amp;quot; error, this is the reason.&lt;br /&gt;
&lt;br /&gt;
That is about the loops, but to finish off, we need to know how to manually exit these loops. A common way to exit an infinite loop is to use an IF statement to determine when to &amp;#039;break&amp;#039; (break is the keyword used to exit a loop) here is an example of an IF statement exiting an infinite loop...&lt;br /&gt;
&lt;br /&gt;
 for(;;)&lt;br /&gt;
 {&lt;br /&gt;
   wait 1;&lt;br /&gt;
   if(var1 == var2)&lt;br /&gt;
    {&lt;br /&gt;
      break;&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The above sequence simply goes...&lt;br /&gt;
- Wait 1&lt;br /&gt;
- check if statement...&lt;br /&gt;
+ if var1 is equal to var2, exit loop&lt;br /&gt;
+ else continue&lt;br /&gt;
- loop&lt;/div&gt;</summary>
		<author><name>Zeroy</name></author>
	</entry>
</feed>