SetAtLimitIfAbove — If variable is above limit, set it at limit. Return value.
Current value of variable, whether or not it was changed.
VarName | Name of variable to check and set. |
LimitValue | Value to check against and set to, if above. |
Condition | Error Code | Error Message |
Contents of variable are invalid. |
-11 |
Variable $VarName has invalid value $Value. |
Input value is empty. |
-12 |
Variable $VarName has empty value. |
Got empty string instead of variable name. |
-3 |
Variable name is missing. Got empty string. |
If variable does not exist, it will be created and set to the limit value.
% set MyVar 1
1
% SetAtLimitIfAbove MyVar 0
0
% puts $MyVar
0
% set MyVar -1
-1
% SetAtLimitIfAbove MyVar 0
-1
% puts $MyVar
-1