Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

nave lahav
388 Pointswhy is this false?
it seems to run fine but doesnt complete the challenge
using System;
namespace Treehouse.CodeChallenges
{
class Program
{
static void Main()
{
try{
Console.Write("Enter the number of times to print \"Yay!\": ");
var times = Console.ReadLine();
int number = Int32.Parse(times);
int i = 0;
while(i != number)
{
if(number<=0){
Console.Write("You must enter a positive number.");
continue;}
i+=1;
Console.WriteLine("Yay");
}
}
catch(FormatException)
{
Console.Write("You must enter a whole number.");
}
}
}
}
1 Answer

Jon Wood
9,884 PointsYou almost got it! I believe your negative number check just needs to be moved before the while
loop. Try moving that and, since you're not in a loop anymore you can remove the continue
statement. Also, try to make it so that if the input is a negative number it doesn't go into the while loop and just prints to the console. Let me know if you need more help!
nave lahav
388 Pointsnave lahav
388 PointsI did exactly what you said and I have the same problem, btw thanks for replying its relly helpful
Jon Wood
9,884 PointsJon Wood
9,884 Pointsnave lahav Can you post your new code? I'll take a look at that to help you a bit further. :)