Double parenthesis on if statement
So I've just watched a video where the guy wrote a if statement like this:
if((minutes < 0) || (seconds < 0) || (seconds > 59))
I didn't know you could write like this and thought this way was the only one:
if(minutes < 0 || seconds < 0 || seconds > 59)
Both works the same,is there any reason to use one instead of the other ?
7 comments · 75% upvoted · other discussions
[deleted]
ColetBrunel 5 points · Feb 2021
Errm. Can we have an example where they don't yield the same results?
spicycurry55 1 points · Feb 2021
They gave a bad example
Using
&&is when things can go awry if you don’t scope the conditional properly