vendredi 20 février 2015

Could Assertions be used for maintaning loop invariants and checking program correctness

I recently saw this question and thought that the person who asked question is correct to some degree. The answer informed that we should not use assertions to perform any tasks in our program.


But assertions can act as easy one liners for maintaining loop invariants and program invariants , so that we can check program correctness to a degree.


And why are the assertions necessary even if we have if else?? It just tests a Boolean expression similar things could be done from if -else ladders or so then why bother creating a new keyword Assertion??


Aucun commentaire:

Enregistrer un commentaire