Operator Name | Symbol | Example |
---|---|---|

Addition | + | var total = price + tax |

Subtraction | - | var difference = score1 - score2 |

Multiplication | * | var stream_time = time * multiple |

Division | / | var payout = loot / players |

Remainder | % | var leftovers = pizza % people |

Square Root | sqrt | var c = sqrt ((a * a) + (b * b)) |

You are probably familiar with addition, subtraction, multiplication, and division. However, you may not be familiar with the remainder. Think back to 3rd-grade math. The

Let's say you have a pizza party. You ordered a total of 32 slices of pizza. Ten guests show up. You give each guest the same amount of pizza. How many slices are left?

Mouse Hover over the **➼ blue text** in the description to highlight the code.

```
extends Node
```# number of people
var people = 10
# number of slices
var pizza = 32
# slices left over
var leftovers = pizza % people
# call functions under func_ready()
func _ready():
# output the amount of left over slices
print (leftovers)

**➼ Number of people**

**➼ Number of Slices**

**➼ Leftovers**

**➼ Output Leftovers**

** Debug Process Started ** OpenGL ES 2.0 Renderer: Mesa DRI Intel(R) UHD Graphics 620 (Kabylake GT2) 2 ** Debug Process Stopped **

The square root is the inverse of square, like addition is the inverse of subtraction. When you square a number (*x ^{2}*) you multiply the number by itself. So

Think back to Geometry class. For a right triangle, the length of the hypotenuse squared (the longest side of the triangle which is opposite the right angle) is equal to the sum of the other two sides squared. This is called the Pythagorean theorem: *a ^{2} + b ^{2} = c ^{2}*

If side ^{2} + 3 ^{2}

```
extends Node
var a = 4
var b = 3
var c = sqrt ((4*4) + (3*3))
func _ready():
print (c)
```

**➼ Length of side a**

**➼ Length of side b**

**➼ Length of side c**

**➼ Output the Length of side c**

** Debug Process Started ** OpenGL ES 2.0 Renderer: Mesa DRI Intel(R) UHD Graphics 620 (Kabylake GT2) 5 ** Debug Process Stopped **

Operator Name | Symbol | Example | Explained |
---|---|---|---|

Less Than | < | a < b | a is less than b |

Greater Than | > | b > c | b is greater than c |

Less than or equal | <= | a <= c | a is less than or equal to c |

Greater than or equal/td> | >= | b >= c | b is greater than or equal to c |

Equal | == | x == y | x is equal to y |

Not Equal | != | a != b | a is not equal to b |

We will look at code examples in our lesson on GDScript if statements

Operator Name | Symbol | Example | Explained |
---|---|---|---|

And | && | color && number | both color and number |

Or | || | steak || fish | Either steak or fish |

Not | ! | !fish | not fish |

We will look at code examples in our lesson on GDScript if statements

Write GDScript code to perform the following calculations

## Want Commander Candy to Grade your Homework?

- Rhonda played a racing game 3 times. Her scores were: 42,000, 66,000, 99,000. What is Rhonda's average score?
- Juan went bought a TV on sale for $99. There is a 9% sales tax. What is the total amount that Juan spent?
- Hanah got paid $500 today. She already spent $150 of it on her phone bill. How much money does Hanah have left?
- The length of a right triangle's hypotenuse is 900 inches. The other sides are equal in length. What is the length of the other sides?
- Katie is drinking a 12 once cup of tea. She has drank 2/3 of the tea. How much tea is left?