I need to write a loop that does something like:
if i (1..10) do thing 1 elsif i (11..20) do thing 2 elsif i (21..30) do thing 3 etc...
As @Baldu said, use the === operator or use case/when which internally uses === :
case i when 1..10 # do thing 1 when 11..20 # do thing 2 when 21..30 # do thing 3 etc...