Function in Constraint

In reply to Shubhabrata:

If you look the error is telling the exact problem, when using functions in constraints they cannot have side effects in this case a side effect is altering the value of num1, you can find more information in the 1800-2017 LRM section 18.5.12 Functions in constraints

“— Functions that appear in constraint expressions should be automatic (or preserve no state information) and have no side effects.”

HTH,

-R