New course! Every coder should learn Generative AI!
Try a free lesson+ 2
assert vs if conditional
When to use assert? If conditional is also similar in functionality
1 Answer
+ 1
Assert is generally used when you want to validate test condition that is you have doubt that at that place it might go wrong whereas if is for normal .
why we need to do this ?
Because if someone sees our code with assert statement indirectly we are indicating him to check that part of code little carefully