return ( (cA && cB && "A & B") || (cA && "A") || (cB && "B") || "neither" );
However, this would also work in Perl, etc, (anything featuring short-circuit evaluation and type coercion for evaluating conditions.)
return ( (cA && cB && "A & B") || (cA && "A") || (cB && "B") || "neither" );