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.
This works because of the return statements. In case of if-else blocks we have to add more else-blocks just to ensure that the conditions below are not executed. Due to return statement the control is passed back to the calling method instantly.
I thought of this logic as if a person sitting and making the decisions. The person looks at the year and decides. If year is same, then looks at the month and decides. If the month is same, then looks at the day and decides.
Library Fine
You are viewing a single comment's thread. Return to all comments →
This works because of the return statements. In case of if-else blocks we have to add more else-blocks just to ensure that the conditions below are not executed. Due to return statement the control is passed back to the calling method instantly.
I thought of this logic as if a person sitting and making the decisions. The person looks at the year and decides. If year is same, then looks at the month and decides. If the month is same, then looks at the day and decides.
decides == return.