Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Assignment Operator: Difference between revisions

From Groundhog Learning
Updated via bot
 
m Updated via bot
 
Line 1: Line 1:
<span id="assignment_operatorassignment-operator"></span>
<span id="assignment_operatorassignment-operator"></span>


Symbol used to give a value to a [[Variable|variable]].
Symbol <code>=</code> used to store a value in a [[Variable|variable]].


<span id="details"></span>
<span id="details"></span>
Line 8: Line 8:
<sub>🤖 ''Pseudocode''</sub>
<sub>🤖 ''Pseudocode''</sub>


<syntaxhighlight lang="console">score = 100 # assigns (stores) the value 100 to the variable score</syntaxhighlight>
<syntaxhighlight lang="console">score = 100 # stores the value 100 in the variable score</syntaxhighlight>
The assignment operator takes the value on the right side and stores it in the variable on the left. This process is always right to left — the value must be evaluated first before being assigned to the variable.
 
<sub>🤖 ''Pseudocode''</sub>
 
<syntaxhighlight lang="console">score = 100  // correct
100 = score  // invalid</syntaxhighlight>
Assigning a value is also called ''setting a variable'' or performing a ''set operation''.
 
<span id="related-actions"></span>
<span id="related-actions"></span>
== Related Actions ==
== Related Actions ==


* ''Used in'': [[Assign_a_Value_to_a_Variable|Assign a Value to a Variable]]
* ''Used in'': [[Assign_a_Value_to_a_Variable|Assign a Value to a Variable]]

Latest revision as of 17:26, 23 October 2025

Symbol = used to store a value in a variable.

Details

🤖 Pseudocode

score = 100 # stores the value 100 in the variable score

The assignment operator takes the value on the right side and stores it in the variable on the left. This process is always right to left — the value must be evaluated first before being assigned to the variable.

🤖 Pseudocode

score = 100   // correct
100 = score   // invalid

Assigning a value is also called setting a variable or performing a set operation.

Related Actions