Change the name from "sales" to "amounts".
Then remove the "decimal[]" from the line:
decimal[] amounts= new decimal[10];
You will end up with:
public static int GetSalesData(out decimal[] amounts)
{
int invalidEntries = 0;
amounts= new decimal[10];
for (int counter = 0; counter < amounts.Length; counter++)
{
try
{
Console.Write("Please Enter a Sales Amount: ");
amounts[counter] = Convert.ToDecimal(Console.ReadLine());
}
catch (FormatException)
{
invalidEntries++;
}
}
return invalidEntries;
}
And no compilation error!
It's an
out
parameter - you must assign a value to it before you exit the method or it won't compile!