Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def loop_iterator(number_of_times)
- phrase = "Welcome to Flatiron School's Web Development Course!"
- counter = 1
- loop do
- counter += 1
- puts phrase
- break if counter > number_of_times
- end
- end
- def times_iterator(number_of_times)
- phrase = "Welcome to Flatiron School's Web Development Course!"
- number_of_times.times do
- puts phrase
- end
- end
- def while_iterator(number_of_times)
- phrase = "Welcome to Flatiron School's Web Development Course!"
- counter = 1
- while counter <= number_of_times
- counter += 1
- puts phrase
- end
- end
- def until_iterator(number_of_times)
- phrase = "Welcome to Flatiron School's Web Development Course!"
- counter = 1
- until counter > number_of_times
- puts phrase
- counter += 1
- end
- end
- def for_iterator(number_of_times)
- phrase = "Welcome to Flatiron School's Web Development Course!"
- times = (1..number_of_times)
- for times in times
- puts phrase
- end
- end
Add Comment
Please, Sign In to add comment