+ 13
What are assertions? Can somebody explain it?
Assertion
2 Answers
+ 2
An assertion is a command that assumes something as necessarily true, then raises an error otherwise. It's useful for debugging - you insert an assertion in your code where you expect, for example, a variable to have a certain value. If it hasn't, your code fails with a clear message, instead of running until something goes wrong and you have to investigate why.
+ 3
Thanks for explaining