Skip to content
← Back to glossary

代入Assignment

Learn in the textbookExpressions, Assignment, and Comments

DefinitionAssignment (代入) evaluates the expression on the right and stores the resulting value in the variable (変数) on the left; in the pseudo-language it is written with "←".

ExplanationAfter an assignment, the variable's old value is gone and the new value takes its place. Even when the same variable appears on both sides, as in "n ← n × 2", the right side is computed first with the current value and the result is then stored back in n. As assignments run one after another, the variable's value changes in the order they are executed.

AnalogyIt is like erasing the number written in a box on a whiteboard and writing a new one in its place.

Memory hookThe arrow "←" points the way the value travels: it flows from right to left.

Related past-exam questions(4 questions)