change-global ( variable quot -- )
Factor documentation > Factor handbook > The language > Dynamic variables > Changing variable values
Prev:change ( variable quot -- )
Next:toggle ( variable -- )


Vocabulary
namespaces

Inputs and outputs
variablea variable, by convention a symbol
quota quotation with stack effect ( old -- new )


Word description
Applies the quotation to the old value of the global variable, and assigns the resulting value to the global variable.

Side effects
Modifies variable

Definition
USING: kernel ;

IN: namespaces

: change-global ( variable quot -- )
[ [ get-global ] keep ] dip dip set-global ; inline