Ruby - decrease integers from params one by one and loop with those
<p>A palindromic number reads the same both ways. The largest palindrome made from the product of two <em>2-digit</em> numbers is <code>9009 = 91 × 99</code>.</p>

<p>Find the largest palindrome made from the product of two <em>3-digit</em> numbers.
I am very new to Ruby and coding, so struggling with this one quite a while. Here is what I have:</p>

<pre><code>def biggest(num, num2)
  total = num * num2
  x = total.to_s.split('')

  until x[0] == x[-1] &amp;&amp; x[1] == x[-2] &amp;&amp; x[2] == x[-3]
    num = num - 1
    num2 = num2 - 1
    total = num * num2
    x = total.to_s.split('')
  end

  return x
end

p biggest(999, 999)
</code></pre>

<p>Problem is that this decreases both params at the same time and gives a wrong answer. I think I should decrease only one number at a time: <code>999 - 1 * 999</code>, and if not meets condition, decrease other: <code>999 - 1 * 999 - 1</code>. And keep looping like this until true. </p>

<p>I know this is not the best approach to this method. It I think it is even wrong from mathematical aspect, but I am just learning, so I kindly ask to give me some insights how this code could be improved. Any optional approaches are very welcome but most important for me is how to fix my mistakes made here.</p>