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 trialLiam Andersson
1,396 PointsAm I missing something?
'''int counter = 0;
while(cycle == true) { counter = counter + 1; } Console.WriteLine(counter); '''
Shouldnt it skip the loop because it hasnt a boolean before the loop that says true? Im a bit confused
6 Answers
Rares Conea
Courses Plus Student 15,000 PointsHi,
Read again the question, it is said there that the value for cycle is true.
Liam Andersson
1,396 PointsYes, But they Never say that it is a boolean? I cant see it, to put ”cycle == True” in while you have to have a boolean right ?
Rares Conea
Courses Plus Student 15,000 PointsThey did not write that line of code but they told you that cycle was set to true. https://imgur.com/yHJ8YiP
Liam Andersson
1,396 PointsSo you dont need to have boolean above the loop?
Benjamin Orimoloye
23,328 Pointsbool cycle = true;
while(cycle == true) { Console.WriteLine("I'm cool."); }
Are you missing the "bool cycle = true"?
Liam Andersson
1,396 PointsNo I didnt miss the boolean, in that quiz question there wasnt a boolean. Idk why and Thats why I’m asking the community :)
Read my code above, Its on 1 line ( dont ask me why)
michaelcodes
5,604 PointsHi there, you are correct in your assumption here that if you were actually writing code you would need to create a boolean variable named cycle for this code to run. I think that for the purposes of this quiz question they omit that from the code and tell you that it is true.
Liam Andersson
1,396 PointsAh thanks Michaelcodes.. I cant set your comment to best answer because it's an answer..