-
Notifications
You must be signed in to change notification settings - Fork 0
/
code.rb
65 lines (49 loc) · 1.17 KB
/
code.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
58
59
60
61
62
=begin
puts "Enter your name"
name = gets.chomp
p
puts "Well that is a lovely name " + name + "."
puts "Enter your age."
#gets, get's the data from the user and chomp chopps off any extra chars
age = gets.chomp
#check wether they are 18 or older
if age < 18.to_s
puts "Sorry you are to young"
else
puts "Welcome to the club you are old enough"
end
=end
##################################################
=begin
#Array of colors:
colors = ["blue", "green", "yello", "pink","purple"]
#prompt the user
p "What is your favorite color?"
p colors
p
#get the color from user
fav_color = gets.chomp
p
#print it out
p fav_color + " is a nice color"
=end
=begin
cars = []
puts "Enter your favorite car"
fav_car = gets.chomp
p
#inserts the user car into the arrary
cars << fav_car
# you can use this syntax insted
puts "Well, #{fav_car} indeed is a nice car"
puts cars
=end
#peters code
puts "what is your first name?"
first_name = gets.chomp
puts "what is your favorite color?"
favorite_color = gets.chomp
puts "which city are you from?"
city = gets.chomp
puts "your first name is #{first_name} and your favorite color is #{favorite_color},you are form #{city}!"
p #makes a newline