Operators and expressions
Of course, in almost any program, we are going to need to "do things" with these variables' values. We can manipulate and change variables with operators. When we combine operators and variables for a result, it is called an expression.
The following sections list the most common Kotlin operators that allow us to manipulate variables. You do not need to memorize them as we will look at every line of code as and when we use them for the first time.
We already saw the first operator when we initialized our variables in the previous section, but we will see it again being a bit more adventurous.
The assignment operator
This is the assignment operator:
=
It makes the variable to the left of the operator the same as the value to the right; for example, as in this line of code:
unreadMessages = newMessages
After the previous line of code has executed, the value stored in unreadMessages
will be the same as the value stored in newMessages
.
The addition operator
This is the addition...