I'm trying to code a method which loads a map according from a number inside loadBoard(NUMBER_HERE); But I get 'unreachable statment' on the line
return board;
Here is my code:
public int[][] loadBoard(int map) {
if (map == 1) { return new int[][] {
{2,2,24,24,24,24,24,3,3,0,0,0,1 },
{ 2,2,24,23,23,23,24,1,3,0,0,0,1 },
{ 1,1,24,23,23,23,24,1,3,3,3,3,1 },
{ 1,1,24,24,23,24,24,1,1,1,1,3,1 },
{ 1,1,1,1,7,1,1,1,1,1,1,3,1 },
{ 5,1,1,1,7,7,7,7,7,1,1,1,1 },
{ 6,3,3,1,3,3,3,1,7,7,7,3,1 },
{ 6,3,3,1,3,1,1,1,1,1,7,1,1 },
{ 3,3,1,1,1,1,1,1,1,1,7,1,1 } };
}else{
return new int[][] {
{ 1,1,1,1,1,24,1,1,1,1,1,1,1 },
{ 1,1,1,1,1,24,1,1,1,1,1,1,1 },
{ 1,1,1,1,1,24,1,1,24,1,1,1,1 },
{ 1,1,1,1,1,24,1,1,24,1,1,1,1 },
{ 1,1,7,1,1,24,24,24,24,1,1,1,1 },
{ 1,1,7,1,1,24,1,24,1,1,1,1,1 },
{ 1,1,1,1,1,24,1,1,1,1,1,1,1 },
{ 1,1,1,1,1,24,1,1,1,1,1,1,1 },
{ 1,3,3,1,1,24,1,1,1,1,1,1,1 },
}; }
return board; }
What am I doing wrong?