Created
June 23, 2015 04:22
-
-
Save JonFranchi/4fa1ca0dd2fcc12301f9 to your computer and use it in GitHub Desktop.
Favorite Foods output
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fav_foods | |
food_arr = [] | |
3.times do | |
puts "Name a favorite food." | |
food_arr << gets.chomp | |
end | |
$i=0 | |
print "your favorite foods are " | |
food_arr.each do |food| | |
$i+=1 | |
if $i < food_arr.length | |
print "#{food}, " | |
else | |
print "and #{food}." | |
end | |
end | |
end | |
fav_foods |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment