Please enable JavaScript to use CodeHS

CodeHS Glossary


Precondition JavaScript

Assumptions we make about what must be true before the function is called.

/*
* 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.
*/
function runToFinish(){
    move();
    move();
    move();
    move();
}