title: Ruby : Can you please explain why reverse range not giving expected result in ruby
body: <p>why the below given <code>[]</code> for a reverse order range in ruby </p>
  
  <pre><code>(0..5).to_a
  # =&gt; [0, 1, 2, 3, 4, 5]
  (5..0).to_a
  # =&gt; []
  </code></pre>
  
  <p>I am new on ruby PL</p>
  
  <p>what is the best way to use a reverse range in ruby</p>
  
  <p>The best way to use a reverse range for iteration</p>
  
  <p>I know <code>.reverse</code> of array</p>
  
  <p>But can I inherit the range and make a custom method of it and use it as a range </p>
  
  <p>I also try</p>
  
  <pre><code>class Range
    def r
      to_a.reverse
    end
  end
  # =&gt; :r
  (5..0).r
  # =&gt; []
  </code></pre>