2021-07-27

Is there a way to use an "or" operator in brackets in C++? ex: if (x > (y || z) )

I want to code something along the lines of: if (x > (y || z) {do stuff}. Unfortunately this doesn't work. I'm not sure what exactly is happening in those brackets, but the end result is nothing.

The issue is that in my case x is it's own long string of characters and equations. So while I realize I could just type: if (equation > y || equation > z) {do stuff}, I want to avoid it.

The only other solution I can think of is to do the above, but first set my long equation to an int. ex:

int x = equation ... if (x > y || x > z) {do stuff}

Which is fine I suppose, but I am just wanting to learn if some shorthand (similar to what I initially proposed) could possibly work.



from Recent Questions - Stack Overflow https://ift.tt/3BI5h6i
https://ift.tt/eA8V8J

No comments:

Post a Comment