Simplest if construction solution ?

HI,
there is a thing what i need :

//////////////////////////////////////////////////////////
if (expression1 > 3 && expression2 >4){expression3 = 5;}
//////////////////////////////////////////////////////////


so, if expression1 equal 0 it shouldn`t be included in whole construction :
-----> if ( expression2 >4){expression3 = 5;}

How to do it by simplest way ?

Thanks a lot for help
So, as I understand it, the logic as follows:

if expression1 == 0 and expression2 > 4, then set expression3 to 5

if expression1 > 3 and expression2 > 4, then set expression3 to 5

otherwise, do nothing

Is that correct?
I don't see a way around testing both conditions anded to the common ex2 > 4 condition.
that is..
if((!ex1 && ex2>4) || (ex1>3 && ex2 >4)) type construct ..
you can factor out ex2>4 maybe, but it just rearranges the above ...
Last edited on
Topic archived. No new replies allowed.