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 5.1.
Task one is to make a loop that prints the following message ten times.
We will do just that.
So we'll create a for loop where I start at zero and this loop is going to keep running so long as I
is smaller than ten.
And every time we run the loop, we need to increase EI by one.
And every time this loop runs, we're going to print the following message.
If Java was easy, they would call it Python.
I totally agree with that.
All right.
And now we will put one breakpoint over here.
And that should be it.
So I start off equaling zero, which is smaller than ten, which means this loop is going to run.
Now I equals one, which is still smaller than ten, so the loop is going to run again.
Now I equals two again.
This condition is going to remain true until I is not smaller than ten.
All right.
So at this point, our loop has run ten times.
By the time we go back, I A-plus Plus is going to make this equal to ten.
Ten is not smaller than ten.
So our loop breaks.
Beautiful.
Tusk two is the number, each line starting from one.
All right, so this means our start needs to be one.
But if you do this, our for loop is only going to run nine times.
So what we need to do is make this smaller than or equal to ten, and we need to print the number during
each iteration.
Och, supposed to put a dart here and we're good.
All right.
We're visualizing the runtime time.
So this time I starts out one.
We're off to a good start.
One If Java was easy, they would call it Python and the last number needs to end at ten.
Let us do just that.
We'll keep going.
So now I equals ten printing the last message.
By the time we get back I A-plus plus updates I to become 1111 is not smaller than or equal to ten so
the loop breaks.
And this loop runs exactly ten times.
I hope you enjoyed this breakpoint session.