title: Check valid input in Ruby
body: <p>I am trying to get valid input from a user by using a while loop. So if the input is not valid I want an error message to come up and repeat itself every time the user does not give valid input</p>
  
  <p>Here is my code - </p>
  
  <pre class="lang-rb prettyprint-override"><code>def suburb
  #user prompt to get information for URL
    puts ' Hey there welcome to house_search! Please which suburb you would like to search...'
    puts '1. sub1 2. sub2'
      suburb_input = input
      while suburb_input != "1" or "2"
          p "please try again"
          suburb_input
      end
  end
  </code></pre>
  
  <p>Does anyone know the best way to do this?</p>