Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Seth Pabst](https://secure.gravatar.com/avatar/d760824bb0308aceadb41ccee9ab5ae4?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Seth Pabst
10,285 Pointsdont get it
in a previous question to this quiz the while loop didn't run because the condition was (false), i thought it had to be (true) to run. But in this example it runs when (false)??
2 Answers
![Steven Parker](https://uploads.teamtreehouse.com/production/profile-photos/969492/micro_tool_chess_set_2.jpg)
Steven Parker
230,688 PointsThe difference between a "while" and a "do...while" is that in a "do...while", the code runs first, and then the condition is tested to see if should repeat. So even when the condition is already false, the code block will run one time.
![Joe Beltramo](https://secure.gravatar.com/avatar/124d6b57028de77e947d8d2801fc9a7c?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Joe Beltramo
Courses Plus Student 22,191 PointsI am not sure which question you are referring to, since it doesn't tell you in the creation of a question. I can only assume it's this one?
Given the code below, what will print out to the console?
do {
console.log('Hello');
} while (false)
console.log('Goodbye');
If so, this runs because in a do...while
statement, the do always runs at least once before it checks the while statement. Had the while statement been true
, it would run until the while statement became false due to a conditional statement in the while loop, or run Infinitely.
Is that the question? If not, please provide the question...