Re: Missing return statement
Ask yourself at what point you know there are no null values anywhere. The method should return true at that point and not before.
Re: Missing return statement
The compiler expect, if the second if statement [else if(board[i][j] != NUL_CHAR)] also false then this method does not return any boolean value. That's why it showing 'missing return statement' compile time error.
Re: Missing return statement
Do not specify the second condition:- if(board[i][j]!!=NUL_CHAR)
Write something like if<condition> dothis else dothat. Also your logic seems to be incorrect, it looks like only the first value gets checked.
Re: Missing return statement
Hi ,use the simple if like
if(board[i][j] == NUL_CHAR)
{
return false;
}
if(board[i][j] != NUL_CHAR)
{
return true;
}
or add the return statement at the end of the method.
Re: Missing return statement
Thanks for all your help guys, I ended up removing the else if statement, and putting the return true; line outside of the loops, but within the method, and it works!
Re: Missing return statement
Well done! Yes, you don't know there are no null values at all until after both loops have finished.