"Ruby Foundations" was retired on September 23, 2015. You are now viewing the recommended replacement.
Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Feeling Loopy with Java!
You have completed Feeling Loopy with Java!
Preview
Do While loops are a post-check looping construct, they will run at least once.
Workspace Snapshots
Read more
Shout outs
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
Now let's do a do while loop, okay.
0:00
So a do while loop.
0:00
It's the same concept, right.
0:01
We don't know how many times
it's going to happen but
0:02
we do know that we want
it to happen one time.
0:03
Right, so
it does what's called a post check.
0:05
So this is useful when you want to
make sure that one time it happens.
0:08
So.
The example that I have for this,
0:12
we're totally shifting examples here.
0:14
The example that I have for this one,
this pseudo code is Mini-Golf, right?
0:15
So, you can't get a hole in zero.
0:19
You have to get a hole in one, right?
0:21
That's the best you can do.
0:22
So you gotta putt once, okay?
0:23
So we're gonna say do.
0:25
Where, is the ball in the hole
is a Boolean over here.
0:28
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up