title: (Ruby) sort=1,rating=0,(sort&&rating) == 1 returns true or false?
body: <p><strong>update: I mistyped 2 variables...so embarrassing. thanks everyone for the effort!</strong> </p>
  
  <p>sorry i find I typed into wrong value for 2 different env, 1st one i set <code>sort = 0</code> and <code>rating=1</code> but then in irb I set <code>sort=1</code> and <code>rating=0</code>. since for <code>a and b</code> when <code>a=1</code> it only evaluates <code>b</code> so in the 2nd situation I get <code>false</code>. now it comes clear. sorry for the careless, thanks everyone for the effort!</p>
  
  <p>======================</p>
  
  <p>my question:
  I have 2 variables, <code>sort</code> and <code>rating</code>, but both <code>sort&amp;&amp;rating == 1</code> and <code>sort and rating ==1</code> behave differently in 2 different env as below:</p>
  
  <p>1st, in the debugger env of rails when I execute <code>rails server --debug</code>, they all return <code>true</code>:</p>
  
  <pre><code>(rdb:130) rating 
  1
  (rdb:130) sort
  0
  (rdb:130) sort and rating == 1
  true
  (rdb:130) sort &amp;&amp; rating == 1
  true
  (rdb:130) (sort &amp;&amp; rating) == 1
  true
  </code></pre>
  
  <p>2nd, in normal irb, they all return <code>false</code>:</p>
  
  <pre><code>irb(main):001:0&gt; sort = 1
  =&gt; 1
  irb(main):002:0&gt; rating = 0
  =&gt; 0
  irb(main):003:0&gt; sort||rating
  =&gt; 1
  irb(main):004:0&gt; sort and rating
  =&gt; 0
  irb(main):005:0&gt; sort and rating == 1
  =&gt; false
  irb(main):006:0&gt; sort &amp;&amp; rating == 1
  =&gt; false
  irb(main):007:0&gt; 0 == true
  =&gt; false
  irb(main):008:0&gt; 
  </code></pre>
  
  <p>I know Ruby is so dynamic that...is this situation possible?</p>