Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def multiple_of_three?(number)
- number % 3 == 0
- end
- def multiple_of_five?(number)
- number % 5 == 0
- end
- def ping_pong_iterate(range)
- range.each do |number|
- word = word_or_number(number)
- puts word
- end
- end
- def word_or_number(word = '', number)
- word << 'APing' if multiple_of_three?(number)
- word << 'BPong' if multiple_of_five?(number)
- word.empty? ? number : word
- end
- range = (1..100)
- ping_pong_iterate(range)
Advertisement
Comments
-
- SCAM, AFTER ADVISING ME TO MAKE A HUGE
- DEPOSIT, NOW NO ANSWER TO MY CALLS OR EMAILS
- ANYMORE, 8200$ GONE.. I SAW A REVIEW OF
- HOW TO GET HELP WITH OLIVIATRADER44 @ GMAIL. COM ON GOOGLE AND I GOT IN CONTACT WITH
- AND MY MONEY WAS RETRIEVED BACK TO
- ME. CONTACT THEM THROUGH THEIR WHATSAPP +1 (423) 248-2140 IF
- YOU NEED HELP TOO
Add Comment
Please, Sign In to add comment
Advertisement