









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










Iteration
public void pickAll() {
while (nextToABeeper()) pickBeeper();
}
Recursion public void pickAll() { if (! nextToABeeper() return; pickBeeper(); pickAll(); }
This recursive definition goes like this: Are there any beepers left on this corner? No - then we’re done. Yes - then pick one beeper and then pickAll. can you write this another way?
the things that need to be true in order for the method to perform its task
what will be true after the method has finished executing - only guaranteed if the preconditions are met