Member-only story

Raheelanjum
3 min readNov 8, 2024

--

Assignment of variables
To "associate" a variable means to symbolically connect a particular piece of information with a name. Any operations that are applied to this "name" or variable must be true for any possible values. The assignment operator is the equals sign, which SHOULD NEVER be used for equality, which is the double equals sign.

Assignment of variables
The '=' symbol is the assignment operator. Caution: although the assignment operator appears as a copy of the classic mathematical equals sign, this is not so. The equals operator is '=='

Design Pattern
End

variable_name = expression;
 
// Expression could be a number: variable_name = 5;
// or a math expression: variable_name = 10 + 5 / 3 - 7; // or a function call: variable_name = sin(5);
To evaluate an assignment statement:

Examine the "right side" of the expression (to the right of the equal sign).
Once everything is worked out, put the computed value into the variables bucket.
More info
We have already seen many assignments. An assignment is "storing a value (of a given type) under a variable name." Think of each assignment as copying the value of the right hand side of the expression into a "bucket" associated with the left hand side name!

--

--

Raheelanjum
Raheelanjum

Written by Raheelanjum

Highly skilled and experienced content writer dedicated to crafting compelling, informative content that resonates with diverse audiences. Expertise spans blog

Responses (7)