-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathif_else.rb
More file actions
29 lines (29 loc) · 788 Bytes
/
if_else.rb
File metadata and controls
29 lines (29 loc) · 788 Bytes
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
if 3 + 2 == 5
puts "3 + 2 does indeed equal 5"
end
my_name = "Chris"
if my_name == "Skillcrush"
puts "Helloooo Skillcrush!"
end
my_name="Chris"
if my_name == "Skillcrush"
puts "Helloooo, Skillcrush!"
else
puts "Oops, I thought your name was Skillcrush. Sorry about that, #{my_name}!"
end
fav_color = 'blue'
if (fav_color=='red')
puts "Red like fire"
elsif (fav_color == 'orange')
puts "Orange like, well... an orange."
elsif (fav_color == 'yellow')
puts "Yellow daffodils are so pretty in the spring!"
elsif (fav_color=='green')
puts "Have you been to Emerald City in Oz?"
elsif (fav_color=='blue')
puts "Blue like the sky!"
elsif (fav_color == 'purple')
puts "Purple plums are the tastiest."
else
puts "Hmm, well I don't know what that color is!"
end