So I was doing a simple for loop and suddenly i got an scope error. if I change the i
in int i = 100
it dissapears but I just want to understand why this happens.
The error appears int the for(int i = 0; i<10; i++)
A local parameter called 'i' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter
class Class1
{
static void Hi()
{
for(int i = 0; i<10; i++)
{
//do something
}
int i = 100;
}
}