Guest User

Untitled

a guest
Apr 25th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. def loop_iterator(number_of_times)
  2. phrase = "Welcome to Flatiron School's Web Development Course!"
  3. counter = 1
  4. loop do
  5. counter += 1
  6. puts phrase
  7. break if counter > number_of_times
  8. end
  9. end
  10.  
  11. def times_iterator(number_of_times)
  12. phrase = "Welcome to Flatiron School's Web Development Course!"
  13. number_of_times.times do
  14. puts phrase
  15. end
  16. end
  17.  
  18. def while_iterator(number_of_times)
  19. phrase = "Welcome to Flatiron School's Web Development Course!"
  20. counter = 1
  21. while counter <= number_of_times
  22. counter += 1
  23. puts phrase
  24. end
  25. end
  26.  
  27. def until_iterator(number_of_times)
  28. phrase = "Welcome to Flatiron School's Web Development Course!"
  29. counter = 1
  30. until counter > number_of_times
  31. puts phrase
  32. counter += 1
  33. end
  34. end
  35.  
  36. def for_iterator(number_of_times)
  37. phrase = "Welcome to Flatiron School's Web Development Course!"
  38. times = (1..number_of_times)
  39. for times in times
  40. puts phrase
  41. end
  42. end
Add Comment
Please, Sign In to add comment