forked from sswebdev/ruby-basics
-
Notifications
You must be signed in to change notification settings - Fork 0
/
methods.rb
59 lines (46 loc) · 966 Bytes
/
methods.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
51
52
53
54
55
56
57
# METHODS
# -------------
#
# Here's an example of a Ruby method:
#
def roll_dice(upper_limit)
number = rand(1..upper_limit)
puts "You rolled a " + number.to_s
end
roll_dice 6
roll_dice 8
roll_dice 12
# CHALLENGE #1:
#
# Copy your solution from CHALLENGE #3 in strings.rb.
#
me = "Jeff is from Skokie"
neal = "Neal is from Chicago"
mike = "Mike is from Freeport"
vince = "Vince is from Ann Arbor"
def display_jeff(person)
line = "-" * 60
puts line
puts "|" + person.center(line.length-2) + "|"
puts line
end
display_jeff("Pickles")
display_jeff(neal)
display_jeff(mike)
display_jeff(vince)
# line = "-" * 36
# puts line
# puts "|" + me.center(line.length-2) + "|"
# puts line
# line = "-" * 36
# puts line
# puts "|" + neal.center(line.length-2) + "|"
# puts line
# line = "-" * 36
# puts line
# puts "|" + mike.center(line.length-2) + "|"
# puts line
# line = "-" * 36
# puts line
# puts "|" + vince.center(line.length-2) + "|"
# puts line