title: Sinatra Conditions
body: <p>After studying ruby for about a month, I decided to move on to Sinatra. I need help understanding a Sinatra snippet which illustrates conditions and routing. Could someone clearly explain what's going on line-by-line and how this block is actually randomizing the route? </p>
  
  <pre><code>set(:probability) { |value| condition { rand &lt;= value } }
  
    get '/win_a_car', :probability =&gt; 0.1 do
      "You won!"
    end
  
    get '/win_a_car' do
      "Sorry, you lost."
    end
  </code></pre>