Immediate assertions vs if statement

Thank you, both the answers were helpful