<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.starfall.wtf/index.php?action=history&amp;feed=atom&amp;title=Basic_math</id>
	<title>Basic math - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.starfall.wtf/index.php?action=history&amp;feed=atom&amp;title=Basic_math"/>
	<link rel="alternate" type="text/html" href="https://wiki.starfall.wtf/index.php?title=Basic_math&amp;action=history"/>
	<updated>2026-07-28T16:13:42Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>https://wiki.starfall.wtf/index.php?title=Basic_math&amp;diff=479&amp;oldid=prev</id>
		<title>PRG: Created page with &quot;== Introduction ==  This tutorial is intended for beginners.  It is intended to show you how to do mathematical calculations with Roblox Studio.  If you haven&#039;t already, please see Your first script as a beginner tutorial.  == What this tutorial will teach you ==  * How to do basic arithmetic with a script * What the arithmetical operators are * The use of parentheses  == Setup ==  You will need to open Roblox Studio.  Once you have done that, you will need t...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.starfall.wtf/index.php?title=Basic_math&amp;diff=479&amp;oldid=prev"/>
		<updated>2024-12-10T22:12:10Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;== Introduction ==  This tutorial is intended for beginners.  It is intended to show you how to do mathematical calculations with &lt;a href=&quot;/index.php/Roblox_Studio&quot; class=&quot;mw-redirect&quot; title=&quot;Roblox Studio&quot;&gt;Roblox Studio&lt;/a&gt;.  If you haven&amp;#039;t already, please see &lt;a href=&quot;/index.php/Your_first_script&quot; title=&quot;Your first script&quot;&gt;Your first script&lt;/a&gt; as a beginner tutorial.  == What this tutorial will teach you ==  * How to do basic arithmetic with a script * What the arithmetical operators are * The use of parentheses  == Setup ==  You will need to open &lt;a href=&quot;/index.php/Roblox_Studio&quot; class=&quot;mw-redirect&quot; title=&quot;Roblox Studio&quot;&gt;Roblox Studio&lt;/a&gt;.  Once you have done that, you will need t...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This tutorial is intended for beginners.  It is intended to show you how to do mathematical calculations with [[Roblox Studio]].  If you haven&amp;#039;t already, please see [[Your first script]] as a beginner tutorial.&lt;br /&gt;
&lt;br /&gt;
== What this tutorial will teach you ==&lt;br /&gt;
&lt;br /&gt;
* How to do basic arithmetic with a script&lt;br /&gt;
* What the arithmetical operators are&lt;br /&gt;
* The use of parentheses&lt;br /&gt;
&lt;br /&gt;
== Setup ==&lt;br /&gt;
&lt;br /&gt;
You will need to open [[Roblox Studio]].  Once you have done that, you will need to click &amp;quot;My ROBLOX&amp;quot;, select your map, and click [[Edit]]&lt;br /&gt;
&lt;br /&gt;
You will need some essentials in [[Roblox Studio]] to make this work:&lt;br /&gt;
&lt;br /&gt;
* The Output window:&lt;br /&gt;
[[Image:Outputwindow.JPG]]&lt;br /&gt;
* The Explorer window:&lt;br /&gt;
[[Image:Explorerwindow.JPG]]&lt;br /&gt;
and &lt;br /&gt;
* The Command bar:&lt;br /&gt;
[[Image:Commandtoolbar.JPG]]&lt;br /&gt;
&lt;br /&gt;
* To make sure you have the Output window, click View / Output.&lt;br /&gt;
* To make sure you have the Explorer window visible, click View / Explorer.&lt;br /&gt;
* To make sure you have the Command bar visible, click View / Toolbars / Command.&lt;br /&gt;
&lt;br /&gt;
== Arithmetical operators ==&lt;br /&gt;
&lt;br /&gt;
[http://www.lua.org/pil/index.html Lua] and Roblox can do mathematical calculations, much like a calculator.  In Lua, there is:&lt;br /&gt;
&lt;br /&gt;
* + Addition (e.g., 2+3=5)&lt;br /&gt;
* - Subtraction (e.g., 5-2=3)&lt;br /&gt;
* * Multiplication (e.g., 5*2=10)&lt;br /&gt;
* / Division (e.g., 10/2=5)&lt;br /&gt;
* - Negation (e.g., -(2)=-2)&lt;br /&gt;
&lt;br /&gt;
== Script ==&lt;br /&gt;
&lt;br /&gt;
A script of:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
print(2+3)&lt;br /&gt;
print(5-2)&lt;br /&gt;
print(5*2)&lt;br /&gt;
print(10/2)&lt;br /&gt;
print(-(2))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will therefore yield the results of 5, 3, 10, 5, and -2.  You can work with decimals and negative numbers as well.  Try inserting this script into Workspace and running it to confirm this.&lt;br /&gt;
&lt;br /&gt;
You can assign numbers to [[Variables]] and do these equations as well:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
x=2&lt;br /&gt;
y=3&lt;br /&gt;
print(x+y)&lt;br /&gt;
print(x-y)&lt;br /&gt;
print(x*y)&lt;br /&gt;
print(x/y)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which gives us 5, -1, 6, and 0.66666666666667.  These are very simple examples (i.e., you don&amp;#039;t have to limit yourself to just two variables).&lt;br /&gt;
&lt;br /&gt;
== Parentheses ==&lt;br /&gt;
&lt;br /&gt;
Parentheses can be used in Lua much as they are used in algebra.  If you want something calculated first, put that in parentheses.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
print((10/20)/5) -- is equal to .5/5, which is .1&lt;br /&gt;
print(10/(20/5)) -- is equal to 10/4, which is 2.5&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Following the associative properties of multiplication and addition, it does not matter how you organize the parentheses in certain instances:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
print((10+20)+5) -- is equal to 30+5, which is 35&lt;br /&gt;
print(10+(20+5)) -- is equal to 10+25, which is 35&lt;br /&gt;
&lt;br /&gt;
print((10*20)*5) -- is equal to 200*5, which is 1000&lt;br /&gt;
print(10*(20*5)) -- is equal to 10*100, which is 1000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
[http://www.lua.org/pil/3.1.html Arithmetic Operators]&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripting Tutorials]]&lt;/div&gt;</summary>
		<author><name>PRG</name></author>
	</entry>
</feed>