2.6

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:

Assignment operator

The assignment operator is used to assign a value.

Arithmetic operators

Arithmetic operators are used to perform basic mathematical operations such as addition, subtraction and division.

Unary operator

We’re only going to cover one unary operator in this course: ! which is used to invert a Boolean value.