+ 2
assert vs if conditional
When to use assert? If conditional is also similar in functionality
2 ответов
+ 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