December 4th, 2021
Code Reading Club Reading Countdown - 4
Countdown - Snippet 4
Today's code reading countdown is written in Ruby!
Snippet in Code
def call total = 0 num_of_violations_allowed = 0 violations.each do |violation| message_length = violation.message.length + 80 # 80 is ~ the size of html wraps violation message if total + message_length < LIMIT total += message_length num_of_violations_allowed += 1 else break end end num_of_violations_allowed end # Submitted by Dan Fishgold
What will be the value of
total at the end of the function?
Submit your answer in our form.