Sum query on a Multi D array

In reply to dave_59:

Hi Dave ,

I didn’t quite understand the 2nd line of constraint c ::



constraint c {
    // constrain the first two columns of cells to add up to 30
    foreach ( cells[r,c] ) {
      cells[r][c] inside { 5,10,15,20 };
      cells[r].sum() with ( item.index < 2 ? item : 0 ) == 30; // How does it work ?
    }
  }


If ternary condition is false , how is the 0 used ?