-
Notifications
You must be signed in to change notification settings - Fork 0
/
ex29.rb
50 lines (37 loc) · 800 Bytes
/
ex29.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#Exercise 29: What If
people = 20
cats = 30
dogs = 15
if people < cats
puts "Too many cats! The world is doomed!"
end
if people > cats
puts "Not many cats! The world is saved!"
end
if people < dogs
puts "The world is drooled on!"
end
if people > dogs
puts "The world is dry!"
end
dogs += 5
if people >= dogs
puts "People are greater than or equal to dogs."
end
if people <= dogs
puts "People are less than or equal to dogs."
end
if people == dogs
puts "People are dogs."
end
#Can you put other boolean expressions from Exercise 27 in the if-statement? Try it.
if people != dogs
puts "Obviously"
end
if people < cats && dogs < cats
puts "cats are dominating"
end
=begin
What happens if you change the initial values for people, cats, and dogs?
The responses change.
=end