Learn
Operators
Putting it All Together

Now that we know a bit about different operators, let’s try writing our own expressions!

As we’ve seen, we can use operators to change something’s value, add other things to our program, to take them away, or to perform calculations. We can also use operators to compare statements or determine whether they are true or false.

One important thing about operators when you program is that they may look different from language to language. That’s because different programming languages have different syntax, or rules for how they are written.

Instructions

Let’s use the operators that we’ve learned to add different fruits to the screen and determine their relationships.

  • Create a variable named orange and set it equal to 4.

  • Decrease the number of oranges from 4 to 2. Save the result to the orange variable again.

  • Run the code and see how many oranges appear on the screen.

Folder Icon

Take this course for free

Already have an account?