We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
|| is a short hand operator. If the left side is evaluated to true, it doesnt even evaluate the right side expression. If a number is odd, the right side expression isnt even evaluated - if the number isnt odd, then it must be even right? why bother adding n%2==0 again?
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Java If-Else
You are viewing a single comment's thread. Return to all comments →
|| is a short hand operator. If the left side is evaluated to true, it doesnt even evaluate the right side expression. If a number is odd, the right side expression isnt even evaluated - if the number isnt odd, then it must be even right? why bother adding n%2==0 again?