title: ruby method : If statement inside an if statement
body: <p>i am getting a lot of errors in my program about not having/having too many "end" markers in my program. i have tested this piece of code before and it works but i was just wondering if someone could tell me whether or not i have enough "end"'s in this if statement or too many. Thanks</p>
  
  <p>def hop!(d)</p>
  
  <pre><code>if d== 0  
      if @current_location.addpoint(0,1) &lt; @boundary1 
      puts "error"
      elsif if @current_location.addpoint(0,1) &gt; @boundary2
      puts "error2"
      else
      @current_location= @current_location.addpoint(0,1) 
      puts "all good"
      end
      end
  elsif d == 1
  if @current_location.addpoint(0,-1) &lt; @boundary1 
      puts "error"
      elsif if @current_location.addpoint(0,-1) &gt; @boundary2
      puts "error2"
      else
      @current_location= @current_location.addpoint(0,-1) 
      puts "all good"
      end
      end
  elsif d== 2
  if @current_location.addpoint(1,0) &lt;  @boundary1 
      puts "error"
      elsif if @current_location.addpoint(1,0) &gt;  @boundary2
      puts "error2"
      else
      @current_location= @current_location.addpoint(1,0) 
      puts "all good"
      end
      end
  
  else d= 3
  if @current_location.addpoint(-1,0) &lt;  @boundary1 
      puts "error"
      elsif if @current_location.addpoint(-1,0) &gt;  @boundary2
      puts "error2"
      else
      @current_location= @current_location.addpoint(-1,0) 
      puts "all good"
      end
      end
  
  end
  </code></pre>