Ternary Operation - unexpected result

I am trying to do a relatively complex Ternary Operation

Option 1
{{(2 == (1 || 2)) ? "Yes" : "No")}}
result is “No” !
But surely this should be “Yes”.

Option 2
{{(2 == 1 || 2 == 2) ? "Yes" : "No")}}
result is “Yes” !
OK that is correct.

Should Option 1 be giving the same result as Option 2?
Why does Option 1 not work and yet I can create it in the data picker?

Option 2 could end up being twice as long as Option 1 as an example here

dmx-bind:value="(sc_menus.data.q_menus.where("menu_list_id", inp_driv_rep_status.value, "==")[0].list_ref != (291 || 351)) ? "" : (((inp_costs_grand_total.value * 1.05) / 10).ceil() * 10).formatNumber(2, ".", ""))"

versus

dmx-bind:value="(sc_menus.data.q_menus.where("menu_list_id", inp_driv_rep_status.value, "==")[0].list_ref != 291 || sc_menus.data.q_menus.where("menu_list_id", inp_driv_rep_status.value, "==")[0].list_ref != 351) ? "" : (((inp_costs_grand_total.value * 1.05) / 10).ceil() * 10).formatNumber(2, ".", ""))"

It could be so easy to create this operation and not realise that the results are incorrect.

Community Page
Last updated: