Rat in a maze doubt

why mam take two if statements for forward and downward ? why can’t we use if else here because if the forward position is blocked then if statement will run and rat will move to downward postion