title: Ruby: "&& return" vs "and return"
body: <p>While going through the Rails guide at <a href="http://guides.rubyonrails.org/layouts_and_rendering.html#avoiding-double-render-errors" rel="noreferrer">http://guides.rubyonrails.org/layouts_and_rendering.html#avoiding-double-render-errors</a> ,
  I wrote a test program to test Ruby's <code>&amp;&amp; return</code>, and I got this strange behavior:</p>
  
  <pre><code>def test1
    puts 'hello' &amp;&amp; return
    puts 'world'
  end
  
  def test2
    puts 'hello' and return
    puts 'world'
  end
  </code></pre>
  
  <p>This is the result output:</p>
  
  <pre><code>irb(main):028:0&gt; test1
  =&gt; nil
  irb(main):029:0&gt; test2
  hello
  world
  =&gt; nil
  </code></pre>
  
  <p>What accounts for the difference?</p>