## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

No credit card required

## Exercise 29. What If

Here is the next script of Ruby you will enter, which introduces you to the `if-statement`. Type this in, make it run exactly right, and then we’ll see if your practice has paid off.

`ex29.rb`

1    people = 20  2    cats = 30  3    dogs = 15  4  5  6    if people < cats  7      puts "Too many cats! The world is doomed!"  8    end  9 10    if people > cats 11      puts "Not many cats! The world is saved!" 12    end 13 14    if people < dogs 15      puts "The world is drooled on!" 16    end 17 18    if people > dogs 19      puts "The world is dry!" 20    end 21 22 23    dogs += 5 24 25    if people >= dogs 26      puts "People are greater than or equal to dogs." 27    end 28 29    if people <= dogs ...

## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

No credit card required