def print_1_upto_100 1.upto(100) do |num| # Only ONCE do the comparison so it can be reused. No need to do it everytime it is needed to be checked if number is multiple by 3. multiple_by_three = num % 3 == 0 # Same as above. Cache/Store the computation results. multiple_by_five = num % 5 == 0 # Initialize the number so we will not use any else at the end of conditionals. text = num if multiple_by_three && multiple_by_five text = 'APingBPong' elsif multiple_by_five text = 'BPong' elsif multiple_by_three text = 'APing' end puts text end end print_1_upto_100