using System;
namespace something
{
class Program
{
static void Main(string[] args)
{
int roomHeight = 10;
int roomLength = 10;
string Length;
for (int i=0; i < roomLength; i++)
{
Length = string.Join(Length, ("a"));
}
}
}
}
This doesn't compile, it does not recognize Length = string.Join(Length, ("a"));
I want it to recognize it as the string I declarated.
string Lenght = string.EmptyLength. You can changestring Lengthto e.g.string Length="".Lenght = string.Join(Lenght, ("a"));<-- What exactly are you trying to do here?var length = new string('a', roomLength);No loop needed.CS0165 Use of unassigned local variable 'Lenght'This error message gives you most of what you need to know to fix the problem.