In SASS, a loop is written like so:
@for $i from 1 through 100 { //stuff }
This would yield 1, 2, 3, 4... all the way to 100.
How would you make the loop go in intervals of two units?
@for $i from 1 through 100 *step 2*{ //stuff }
So the result is 1, 3, 5, 7... to 99
It isn't in the documentation because it simply isn't implemented. What you want to do can be done with the @while directive.
@while
$i: 1; @while $i < 100 { // do stuff $i: $i + 2; }
1.4m articles
1.4m replys
5 comments
57.0k users