I know you read equality ==
in if (x == 5)
this way:
If x is equal to 5 . . .
But how do you read it in a coding context (assignment); i.e. =
in x
= 5
?
There are very minor differences but they are basically the same:
if (x == 5)
Is pronounced - if x is equal to five
x = 5
Is pronounced - x equals five
Another, more technical way (the above is a colloquial term) is set x to five.
Programming Answer:
If (x == 5) { (code) }
tells the computer:
If (x is equal to 5) { Do this code }
While
x = 5
tells the computer
The variable x currently has the value of 5. (Anywhere the variable "x" is used the value of 5 will replace it unless x is changed later)
The reason we use "==" for "equals" is because we had already decided that " = " means "is assigned to"
Math Answer
In algebra and calculus "x = 5" would be "x equals 5"
x = 5
could mean different things in different programming languages).