Loops Just like in Alice or AppLab it is often useful to use loops to repeat code statements. Even if something is being repeated just 2x, it is useful to use loops because:
The two main types of loops are
while loops
for example
for loops are in the format: for (this counter variable staring here, while this condition met, do this to the counter)
this would repeat the inside 10 times (while i was 0 through 9)
Exiting (not used all that often, just reference) To exit the current loop, you use the statement:
Lets create these methods: HERE IS STARTER CODE
|