@for directive is used to run a loop a set number of times to generate classes.@for $i from 1 through 3 { .m-#{$i} { margin: #{$i}rem; } }.m-1, .m-2, and .m-3, each setting margin to 1rem, 2rem, and 3rem respectively.How can you use variables inside class names when generating utility classes with loops?Use string interpolation with <code>#{} </code> to insert variables into class names or property values.Why is generating utility classes with loops better than writing each class manually?@for $i from 1 through 5.#{$i} to insert the variable value inside class names.@for $i from 1 through 2 { .p-#{$i} { padding: #{$i}rem; } }
@repeat is not a valid Sass directive; valid loops are @for, @each, and @while.