title: Strange result in Ruby with "end if"
body: <p>I expect this code to execute the code block and result in the output <code>"x"</code> and <code>"y"</code>, or just to throw a syntax error:</p>
  
  <pre><code>if true
    puts "x"
  end if
  puts "y"
  </code></pre>
  
  <p>However, the interpreter ignores the <code>if true</code> block and only executes <code>puts "y"</code>. If I instead enter the following code:</p>
  
  <pre><code>if true
    puts "x"
  end if
  </code></pre>
  
  <p>the interpreter exits with an end-of-input syntax error. Is there a reason why the first snippet is valid code but somehow executing wrong? It would seem to me that there is some error in the parser. </p>
  
  <p>I've confirmed this in Ruby 2.1.2 as well as Ruby 2.1.5.</p>