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 trialterence lara
693 PointsC# BASIC FINAL PART 1
I am not sure how to initialize the loop for when count is less than userInput. This should add one to the count depending on the userInput value in the else statement, then use count to go through the loop for another check?
using System;
namespace Treehouse.CodeChallenges
{
class Program
{
static void Main()
{
var count = 0;
while (true)
{
Console.Write("Enter the number of times to print \"Yay!\": ");
var input = Console.ReadLine();
var inputTimes = int.Parse(input);
if (inputTimes <= count)
{
Console.Write("That is not enough for a Yay");
continue;
}
else
{
Console.Write("Yay!")
count = count + 1;
}
}
}
}
}
1 Answer
Steven Parker
231,269 PointsThe loop should start after the input.
The prompt and input will only occur one time, so that part should not be inside the loop.
Also, the challenge is very picky about output messages. Only output what the instructions ask for specifically. Save the creative explorations for the workspace.