1. Looping and methods
At this point, we know how to write our own methods and how to loop through arrays. Now let's put those skills together.
2. Combine loops and custom methods
Here, we'll combine for loops with custom methods to solve problems that involve working with multiple values like doubling each number in an array or finding the longest word in a list.
3. Loop through an array and square each element
The idea is simple: use a loop to go through each item, and call our method to do something useful with it. For example, we can loop through an array of numbers and call a method that squares each one.
4. Find the longest word in an array
Or loop through an array of Strings and call a method that checks which word is longest.
Combining methods and loops is a powerful way to write clean, reusable code - and it reflects how many real-world programs are structured.
5. Let's practice!
You've already got all the tools. Now it's time to practice using them together!