Please enable JavaScript to use CodeHS

CodeHS Glossary


Precondition Java

Assumptions we make about what must be true before a method is called. Preconditions should be written in the comment above a method. For example: ``` /* * Precondition: Karel has just jumped the * last hurdle, and is facing east. * Postcondition: Karel is all of the way * at the end of the world. */ private void runToFinish(){ move(); move(); move(); move(); } ```