Loops
Goals
Step 1
Type this in irb:3.times { puts 'Hip, hip, hooray!'}
Step 2
Type this in irb:beatles = [ "John", "Paul", "George", "Ringo"] beatles.each { |beatle| puts "Hi, my name is #{beatle}"}Type this in irb:ducks = ['Huey', 'Dewey', 'Louie'] ducks.each { |duck| puts "#{duck} quacks!" } ducks.each { |zombie| puts "#{zombie} quacks!" }
Step 3
Type this in irb:('a'..'z').each { |letter| puts letter }Type this in irb:('a'...'z').each { |letter| puts letter }
Step 4
Type this in irb:total = 99 colors = ['red', 'blue', 'green'] colors.each do |color| puts "#{total} colors of paint on the wall..." puts "Take #{color} down, pass it around..." total = total - 1 puts "#{total} colors of paint on the wall!" end
Challenge(s)
Oh, hello, Sally Samsonite! Oh, hello, Johnny Jameson! Oh, hello, Beth Benitsky! Oh, hello, Corinne Camelia!The sum of all of the numbers is 30.
Explanation
Next Step:
Go on to Summary: Basics