up previous next
protect    --    protect a variable from being overwritten


Syntax
protect X;
protect X : reason;
  where reason: STRING

Description
This command protects the variable X from being assigned to. Attempting to assign to it will produce an error; if a reason (STRING) was given it is printed in the error message.

Example
/**/  MaxSize := 99;
/**/  protect MaxSize : "size limit for fast computation";
-- /**/  MaxSize := 1000; --> !!! ERROR !!! as expected: Cannot set "MaxSize"

/**/  unprotect MaxSize;  --> remove protection, X may be assigned to now
/**/  MaxSize := 1000; --> OK

See Also