title: How to check if a string is an Integer or Float
body: <p>I want to check if my variable is either an integer or float. This is for a calculator. I don't want it to be looping indefinitely.</p>
  
  <p>How would I do so? I tried to do the following:</p>
  
  <pre><code>puts "Enter a number: "
  num1 = gets.chomp()
  while !(num1 == Integer.superclass or num1 == Float.superclass)
    puts "Enter an actual number: "
    num1 = gets.chomp()
  end
  </code></pre>