Monday, June 23, 2025 18:51

Posts Tagged ‘assignment operator’

Assignment operators

Friday, January 6th, 2017

This is the simplest operator of them all. It’s expressed simply by the equal (=) sign. Assignment operators are used to assign (give) a value to a variable.

They can also be used in cascade. Lets have a look at simple and cascaded assignment:

string name = "John Doe";
int x, y, z;
x = y = z = 3;

One very important thing to always remember is NOT to confuse the assignment operator = with the comparison operator == (a very common programming mistake).… Read more