0

This is my code for move:

 for(i=0;i<d;i++)
    {
          for(j=0;j<d;j++)
         {    if(a[i][j]==tile)
             {
                   e=i;
                   f=j;
              }
              else
              {
              return false;
               }
            }
      }

for(i=0;i<d;i++)
{
 for(j=0;j<d;j++)
 {
  if(a[i][j]==blank)
  {
    break;
  }
 }
}  
if( e==i)
 { 
    if (f==j+1 || f==j-1)
    {
    //swap
    return true;
    }

  }
   else if(f==j)
   {
   if(e==i+1 || e==i-1)
   {
    //swap
    return true;
   }
}
 else
 {
 return false;
 }

even though i've done return false at the end, why is it still giving me this error?

1
  • Make sure all the opening braces have been closed. – Ibrahim Dec 30 '14 at 20:08
0

You're right, that error usually occurs when there's the possibility of not having a return value. So if you're sure every possible result/outcome has been covered by an appropriate return value, then it's usually because you're missing a ";" or "}", meaning your code isn't properly closed and compiler is looking for it to continue.

Not the answer you're looking for? Browse other questions tagged .