# Exercise 1
In the following code, notice that variable i is declared on line 7. Variable i is declared again on line 11. Will this code compile successfully or not?
Answer the question without running the code in your IDE. Explain your answer.
using System;
class MainClass
{
public static void Main(string[] args)
{
for (int i = 0; i < 10; i++)
{
Console.WriteLine(i);
}
for (int i = 0; i < 10; i++)
{
Console.WriteLine(i);
}
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16