-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path04_01.rb
More file actions
41 lines (28 loc) · 796 Bytes
/
Copy path04_01.rb
File metadata and controls
41 lines (28 loc) · 796 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
30
31
32
33
34
35
36
37
38
39
40
41
puts "Hi"
puts "What's your first name?"
firstname = gets.chomp
firstname = firstname.gsub(/\w+/) do |word|
word.capitalize
end
puts "-------------------"
puts "What's your middle name?"
middlename = gets.chomp
middlename = middlename.gsub(/\w+/) do |word|
word.capitalize
end
puts "-------------------"
puts "What's your last name?"
lastname = gets.chomp
lastname = lastname.gsub(/\w+/) do |word|
word.capitalize
end
puts "-------------------"
fullname = "#{firstname} #{middlename} #{lastname}"
puts "Hi #{fullname}"
puts "-------------------"
puts "#{firstname}, What's your favourite number?"
fav_number = gets.chomp
new_fav_number = fav_number.to_i + 1
puts "-------------------"
puts "I think your new favourite number should be #{new_fav_number}"
puts "-------------------"