Quantcast
Viewing all articles
Browse latest Browse all 10

Two if conditions or one if with OR

I have a small doubt

I have following code

bool res= false;if(cond1){   res = true;}if(cond2){   res = true;}

Instead of this if I put following code

if(cond1 || cond2){   res = true;}

Which code snippet will be more optimized?

I believe it would be second one as I have avoided an If condition.


Viewing all articles
Browse latest Browse all 10

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>