Nested logic

Is the following legal? (If the answer is yes, standby for a chunk of code with a silly mistake)

If (logicexpression1) || (logicexpression2) {

I'm saying if 1 OR 2 is true, then go for it.....

An Internet search comes up with lots of nested if expressions, but this looks cleaner.

Nope
But

If (logicexpression1 || logicexpression2) {

or

If ((logicexpression1) || (logicexpression2)) {

are correct

The idea is legal but your use of it is wrong

if ((logicexpression1) || (logicexpression2))
  {
    //do stuff
  }

Of course, it is very easy to test with a few lines of code

Ah. Thanks, I was lazy, I was actually using the second example. The compiler accepts it, but the result always comes out as true. My mistake must lie elsewhere. Is this structure used much, or is it something that makes experienced programmers wince?
My last programming experience was long long ago on the Uni's DEC10

Statement is very common :slight_smile:

If it's always true I would start splitting the two expressions to see which of the two is always true.