I have a method that will return a number between 1 – 100
depending on whether the response (x) is between
100 – 90 i would like one response, 89 – 85 another 84 – 72 another … etc
I use
if x > 90
response a
elsif x > 85
response b
elsif etc...
but this seems a little messy, is there a better way of refactoring this?
Many thanks.
Take advantage of
Range#===and use acasestatement: