x
x
x


Do so in a way which:

 does not involve string manipulation of the input source code
 is plausibly extensible to a runtime-chosen set of bindings rather than just x
 does not make x a global variable


or note that these are impossible.



See also

 For more general examples and language-specific details, see Eval.
 Dynamic variable names is a similar task.


import "meta" for Meta
 
var x
Meta.eval("x = 2")
System.print("First  x = %(x)")
var y = x // save this value
 
Meta.eval("x = 5")
System.print("Second x = %(x)")
 
Meta.eval("x = x - y")
System.print("Delta  x = %(x)")