Next: , Previous: , Up: Primitive expression types   [Index]


4.1.6 Assignments

syntax: set! ⟨variable⟩ ⟨expression⟩

Semantics: ⟨Expression⟩ is evaluated, and the resulting value is stored in the location to which ⟨variable⟩ is bound. It is an error if ⟨variable⟩ is not bound either in some regionenclosing the set! expression or else globally. The result of the set! expression is unspecified.

(define x 2)
(+ x 1)      ⇒ 3
(set! x 4)   ⇒ unspecified
(+ x 1)      ⇒ 5