+ 2

assert vs if conditional

When to use assert? If conditional is also similar in functionality

30th Jan 2018, 11:56 PM
Haider Ali
Haider Ali - avatar
1 Resposta
+ 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
1st Feb 2018, 10:05 AM
anwesh jami
anwesh jami - avatar