Complex If statement

I want to test for 4 logical values

A,B,C,D are boolean values

if (A and B) or ( C and D)

can I write

if((A && B) || (C && D)){

// do this if true

}

Thanks

Try it out. Does it work?