public void Dashes()
{
for (int i = 0; i < SelectedWord.Length; i++)
console.WriteLine("_");
}
this is the only thing i can think of and whenever I go to run it puts it on all separate lines when I want it on 1 line
public void Dashes()
{
for (int i = 0; i < SelectedWord.Length; i++)
console.WriteLine("_");
}
this is the only thing i can think of and whenever I go to run it puts it on all separate lines when I want it on 1 line
public void Dashes()
{
for (int i = 0; i < SelectedWord.Length; i++)
console.Write("_");
}
Thanks to @Grant Winney
Try this
string output = "";
for (int i = 0; i < SelectedWord.Length; i++)
{
output += "_";
}
console.WriteLine(output);
The console,writeline prints starts a new line everytime its called in your loop.
public void Dashes()
{
string dashes ="";
for (int i = 0; i < SelectedWord.Length; i++)
dashes +="_";
console.WriteLine(dashes);
}
You can also ditch the loop entirely if running .NET 4 or above and use the following single line (as per this answer):
console.WriteLine(String.Concat(Enumerable.Repeat("_", SelectedWord.Length)));