Introduction to operators
Operators are used to perform functions on the data in our variables. In this video, you will learn about some of the ways operators can be used, see examples of operators in the game code, and find out how you can use the IDE to implement and test operators in the code.
In this activity we’ll be looking at some of the most commonly used operators. These fall into four main groups:
The assignment operator is used to assign a value.
Arithmetic operators are used to perform basic mathematical operations such as addition, subtraction and division.
We’re only going to cover one unary operator in this course:
! which is used to invert a Boolean value.
Equality, conditional and relational operators
These operators are used in conditional statements, which we will learn more about in Week 3.
We’ll cover each of these in more depth in the next few steps, as well as looking at operator precedence (the rules that govern the order in which operators are evaluated).