Iteration: while for - tstorrnetnz/teaching2022 GitHub Wiki
Learning Aims - Use loops to repeat tasks
For you to do:
This week we will look at repetition using for loops.
Useful resources to help you out include:
-
Otago Level 2 book - Chapter 6. This covers both while and for loops. 6.3 is the for loop part. I'm not covering while loops in the revision in any detail - you can read and try for yourself.
-
HTTLACS Chapter 7 - again for loops are covered after while loops https://books.trinket.io/thinkjava/chapter7.html I'd read through - understand and have a go at the repl.it problems. A great explanation of for loops https://funnelgarden.com/java-for-loop/#For_Loop and of course some material from me: https://sites.google.com/netnz.school.nz/csp/l2-revision?authuser=0#h.p_6YFiMm3zEogp
-
These are the problems to do:
Problem 31 is a bit more difficult.
Note that I am leaving you to explore while loops for yourself - they are quite a bit easier.
Extension work: OUWB problems 9 & 10 on pg 86 https://www.codesdope.com/practice/java-loop-loop-loop/ both the Level 1 and the Level 2 problems