Array constraint. Each row total should be 100, with each element less than 80. I want to understand how to do this using only sum method of array

In reply to dave_59:

That’s a nice trick for the False Operand .

So if I need to constraint elements within a range ( along with the sum ) ,
Would the following be permissible too ? ::


constraint array_c   {     
    foreach  (array1[i]) 
      array1[i].sum(item) with ( ( item inside { [ Low : High ] , Specific value1 , Specific value2 , ...  } ) ? item : 101) == 100; 
  }

The basic logic being that inside returns 1’b0 / 1’b1 .