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 trialFEI LI
828 PointsNo overload for method `ReadLine' takes `1' arguments
I don't understand...
using System;
namespace Treehouse.CodeChallenges
{
class Program
{
static void Main()
{ int numberOfPrint=0;
Console.ReadLine(numberOfPrint);
Console.Write("Enter the number of times to print \"Yay!\":numberOfPrint");
while (numberOfPrint>0)
{Console.Write("Yay!");
numberOfPrint--;
}
}
}
}
1 Answer
Steven Parker
231,236 PointsThe message is telling you that ReadLine doesn't take any arguments.
But when you called it, you passed it "numberOfPrint" as an argument instead of leaving the parentheses empty.
I'd bet what you really meant to do is take the value that comes back from ReadLine, convert it into a number, and then assign that to "numberOfPrint".
And you probably want to do all that after you write out the message asking for a number.