0
I'm having a difficult time understanding assertions. Can someone please explain assertions to me?
3 odpowiedzi
+ 2
You can use assertions to debug your program. It's a bit like a raise-if-not statement.
+ 2
Some times while programing we do not see certain mistakes we make, so assertions are milestones that help us assure we are on the right track. Using them we make sure our program will operate as desired. They serve to show us where and what kind of error happend, so we can fix it.
0
Assertion acts pretty much like exception handler but you can place assertion mostly after receiving user input to check if it is valid input,if it is valid then the program will continue otherwise it will terminate and the rest of the lines will not be executed. This will make your program run smoothly and to be perfect.