static void Main(string args)
string ageAsString = "102";
string nameAsString = "Granny";
outcome = Int32.TryParse(ageAsString, out int ageAsInt);
The above is what I have so far, I am on step two. I am getting an error after this step. “A local variable or function named ‘ageAsInt’ is already defined in this scope.” I am not sure what it means and I cant figure out what I’m doing wrong.
The error is telling you that you are trying to declare a variable that has already been declared. Here you declare ageAsInt:
Here, you declare it again:
If you leave the int out of the above statement, you are referring to the previously declared variable rather than declaring it a second time. The other option would be to delete the previous declaration, and declare it as you have here in the out parameter. I think the exercise wants you to keep the original declaration, and use the original variable in the out parameter.
Also, FYI, to make it easier for others to read your code, and offer assistance, you can retain your code’s original formatting by placing it between otherwise empty lines that have 3 back ticks on them: