Directive @while in SASS
When creating cycles in the Sass language, it is very convenient to use the @while directive, in which you must write a counter variable. Let's take a closer look at how it works using the following example:
$i: 4;
@while $i > 0 {
.li-#{$i} { font-size: 4px * $i; }
$i: $i - 1;
}
Compilation result:
.li-4 {
font-size: 16px;
}
.li-3 {
font-size: 12px;
}
.li-2 {
font-size: 8px;
}
.li-1 {
font-size: 4px;
}
Tell me what the result of compiling the following code will be:
$count: 10;
@while $count > 0 {
.link-#{$count} { padding: 4px + $count; }
$count: $count - 2;
}