SetAtLimitIfBelow — If variable is below limit, set it at limit. Return value.
Current value of variable, even if it was not changed.
VarName | Name of variable to check and set. |
LimitValue | Limit value to check against and set to, if below. |
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 the variable does not already exist, then it will be created and set to the limit value.
% set MyVar -1
-1
% SetAtLimitIfBelow MyVar 0
0
% puts $MyVar
0
% set MyVar 123
123
% SetAtLimitIfBelow MyVar 0
123
% puts $MyVar
123