setVarWriteProtect
setVarWriteProtect(s_name) =>t/nil
Description
(SKILL mode only) Sets the write-protection on a variable to prevent its value from being updated. Does not work in SKILL++ mode.
Use this function in SKILL mode only when the variable and its contents are to remain constant.
- If the variable has a value, it can no longer be changed.
- If the variable does not have a value, it cannot be used.
- If the variable holds a list or other data structure as its value, it is assumed that the contents will not be changed. If you try to update the contents, the behavior is unspecified.
In SKILL++ mode, use setFnWriteProtect instead.
Arguments
Value Returned
Examples
y = 5 ; Initialize the variable y.
setVarWriteProtect( 'y )=> t ; Set y to be write protected.
setVarWriteProtect( 'y )=> nil ; Already write protected.
y = 10 ; y is write protected.
*Error* setq: Variable is protected and cannot be
assigned to - y
Related Topics
Function and Program Structure
Return to top