Groovy AND OR logic

I read it but not fully understanding
I want to do a IF against 4 values , but not sue how to code it
Either 1 or 2 and 3 or 4

If (a == "off" || a== null && b=="off" || b== null){

This right so the there must be a true on both sides of the && to be true overall?

Parentheses are your friend here. This will make sure things evaluate in the order you’d prefer.

If (((a == "off") || (a== null)) && ((b=="off") || (b== null))){

2 Likes

Good :telephone_receiver: