Assertions and Preconditions
Assertions and Preconditions
Introduction
Hello,
Assertions and preconditions are the processes of checking the application at runtime.
Before running any code, it checks that certain conditions are met and this usually happens with the bool operator.
If true, the code continues. Otherwise, the code block stops running and the app becomes terminated.
cont.
Assertions are used during development to find code errors in the application. Preconditions are used to control errors during production.
We can think of them as suitable methods to provide application documentation.
We shouldn't think of these as error handling. Because if they are used and the conditions are not met, they generate errors in the application and cannot be caught.