Before we start, did you try solving the workbook yourself?
If not, please click the link in the resources folder and follow the instructions for this workbook.
Welcome to Workbook 6.2.
Instructions for this workbook are all learning the part.
So let's begin.
Task one Once again, create a new array of five students.
So we're going to create an array that can store string elements called seeds.
And the elements it will store are the ones from learn the Part.
Okay.
Looking good.
And now, instead of creating five print statements for each element, we're going to have a four loop
that's going to be tasked to create a four loop that runs through the length of the array and prints
a message for each element.
So we'll say four.
INT I is going to start at index zero of the array.
The for loop will keep running so long as the index I is smaller than the length of the array and every
time the loop runs we increase ie by one.
The counter.
I will start at zero until it eventually reaches four.
So when the loop is running, we can use AI to index every single element in the array.
All right.
The best way to understand what's going on is to visualize the runtime.
So I will just put one breakpoint over here and let's begin.
So because there are five elements, the length of this array is five.
The for loop start at I equals zero.
The element at index zero is Malfoy.
When the for loop runs a second time, we're indexing the element at I equals one.
So that's crab.
Now we're at I equals two goil.
I equals three pansy.
I equals four, Dean.
And now I a plus plus is going to increase our counter to five.
The length of the array is five.
Five is not smaller than five.
So the for loop ends press continue.
And we are done comparing this to what we have inside of learn the part.
Everything looks perfect.