forked from sswebdev/ruby-basics
-
Notifications
You must be signed in to change notification settings - Fork 0
/
strings.rb
55 lines (30 loc) · 819 Bytes
/
strings.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
# STRINGS
# -----------
#
# Example: What's your name and where are you from?
# CHALLENGE #1. Change this code to match the people around your table.
me = "Jeff is from Skokie"
neal = "Neal is from Chicago"
mike = "Mike is from Freeport"
vince = "Vince is from Ann Arbor"
puts me
puts neal
puts mike
puts vince
# CHALLENGE #2. Can you append something special if the person is from Chicago?
puts me
if me.include?("Chicago")
puts "Alright!"
end
puts neal
if neal.include?("Chicago")
puts "Alright!"
end
# CHALLENGE #3. Can you put a fancy border around each name, kind of like this:
# ----------------------------------------
# | Jeff is from Skokie |
# ----------------------------------------
line = "-" * 36
puts line
puts "|" + me.center(line.length-2) + "|"
puts line