
2.4.1 Immediate and delayed assignments: Set and SetDelayed There are two assignment commands in Mathematica: immediate and delayed assignment. The immediate assignment is performed with the equal sign (=), say x = y, which means "assign to x the value that y has right now". This command has a literal equivalent Set: we could equivalently write Set[x,y]. For delayed assignment, one has to use (:=) (semicolon plus an equal sign), say x:=y. The literal equivalent is the SetDelayed command, for instance SetDelayed[x,y]. This means "add to the global rule base a rule, which will substitute x every time that x is encountered, by the value that y will have at that moment". So, with this kind of assignment, the right hand side is not evaluated at the moment of assignment, but is reevaluated every time when the lefthand side appears somewhere in the program. This is the main difference between the two assignment operators, since with Set, the l.h.s. is assigned the value that the r.h.s. has at the moment of assignment, "once and for all".

