Asked by e
In the following code, what would be a good Postcondition to write?
/* Precondition: Karel is on a spot with a tennis ball facing East
* Postcondition: ...
*/
function getOnTop() {
turnLeft();
move();
turnRight();
}
JavaScript
Karel is on a spot with a tennis ball facing north
Karel ends one spot above a tennis ball facing East.
Karel is on the same position but on top of a ball.
Karel is facing East.
/* Precondition: Karel is on a spot with a tennis ball facing East
* Postcondition: ...
*/
function getOnTop() {
turnLeft();
move();
turnRight();
}
JavaScript
Karel is on a spot with a tennis ball facing north
Karel ends one spot above a tennis ball facing East.
Karel is on the same position but on top of a ball.
Karel is facing East.
Answers
Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.