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 trialnave lahav
388 Pointswhy is that wrong?
it says it didn't get what it was expecting while I copy paste the same thing
using System;
namespace Treehouse.CodeChallenges
{
class Program
{
static void Main()
{
try { Console.Write(" Enter the number of times to print \"Yay!\": ");
var i = 0;
var num = int.Parse(Console.ReadLine());
while(true)
{
if(i>= num)
{ break; }
Console.WriteLine("Yay!");
i+= 1;
}
}
catch(FormatException)
{
Console.Write("You must enter a whole number.");
}
}
}
}
1 Answer
Steven Parker
231,236 PointsIt looks like you altered the original Write statement.
The instructions say, "Leave this as it is.", but it looks like you added a space at the beginning before the word Enter.
Put that line back the way it was and you should pass task 2.
But what did you mean by "copy paste the same thing" .. same as what? Aren't you writing the code for this challenge for the first time?
nave lahav
388 Pointsthe text that should appear
Steven Parker
231,236 PointsYou shouldn't have to copy/paste that. It was given in the challenge code to start with.
Anyway, just remove that extra space at the beginning of the string and you'll pass.
Jon Wood
9,884 PointsJon Wood
9,884 PointsI ran your code and so far it looks good to me. What error is it saying?