public static int [] tallyResults (String number, String guess)
{
int bulls = 0;
int cows = 0;
for (int i=0;i<number.length();i++)
{
if (number.charAt(i)==guess.charAt(i))
{
bulls = bulls + 1;
}
else if (contains(number, guess.charAt(i)))
{
cows = cows + 1;
}
else
{
continue;
}
cows = cows - bulls;
int [] count = {bulls, cows};
}
return count;
}
This is a function I'm creating that's part of a larger problem for my CS class. I need to return the array that I declared. However, when I attempt to compile, I get an error:
BullsAndCows.java:94: error: cannot find symbol
return count;
^
symbol: variable count
location: class BullsAndCows
I've messed around with it for a bit and looked online for answers, but nothing seems to do the trick.