Hello,
I'm on Chapter 5, page 111, doing the Try IT OUT Using an Array here's my code:
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Ch05Ex04
{
classProgram
{
staticvoid Main(string[] args)
{
string[] friendNames = { "Robert Barwell", "Mike Parry", "Jeremy Beacock" };
int i;
Console.WriteLine("Here are {0} of my friends:", friendNames.Length);
for (int i = 0; i < friendNames.Length; i++)
{
Console.WriteLine(friendNames[i]);
}
Console.ReadKey();
}
}
}
The error I get is this:
Error 1 A local variable named 'i' cannot be declared in this scope because it would give a different meaning to 'i', which is already used in a 'parent or current' scope to denote something else
How do I fix this, or is it a book mistake?
Thanks in advance
Paul