Note that there are some explanatory texts on larger screens.

plurals
  1. POElse can't find the If statement even though there is one
    primarykey
    data
    text
    <p>When I try to compile this code I get an error saying else without if. I believe that I have all of the braces in the right place. I also get other errors to that are in the picture that I have attached but I just believe they are there because of the can't use else without if error. </p> <p>Problem code:</p> <pre class="lang-java prettyprint-override"><code>public static boolean goNorth(){ boolean success; if(maze[currCol]currRow - 1] == CLEAR){ maze[currCol][startRow -1] = PATH; currRow--; success = goNorth(); if(!success){ success = goWest(); if(!success){ success = goEast(); if(!success){ maze[currCol][currRow] = VISITED; currRow++; } } } return success; } else { return false; } } public static boolean goWest(){ boolean success; if(maze[currCol - 1]currRow] == CLEAR){ maze[currCol - 1][startRow] = PATH; currRow--; success = goWest(); if(!success){ success = goSouth(); if(!success){ success = goNorth(); if(!success){ maze[currCol][currRow] = VISITED; currCol++; } } } return success; } else { return false; } } public static boolean goEast(){ boolean success; if(maze[currCol + 1]currRow] == CLEAR){ maze[currCol + 1][startRow] = PATH; currRow--; success = goEast(); if(!success){ success = goNorth(); if(!success){ success = goSouth(); if(!success){ maze[currCol][currRow] = VISITED; currCol--; } } } return success; } else { return false; } } public static boolean goSouth(){ boolean success; if(maze[currCol]currRow + 1] == CLEAR){ maze[currCol][startRow + 1] = PATH; currRow--; success = goSouth(); if(!success){ success = goEast(); if(!success){ success = goWest(); if(!success){ maze[currCol][currRow] = VISITED; currRow--; } } } return success; } else { return false; } } </code></pre> <p>Error:</p> <p><img src="https://i.stack.imgur.com/cvngF.jpg" alt="screen shot"></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload