Found a bug in while task of Sass

Hello Folks,

I was learning Sass from FCC. I was trying to write the following piece of code for “@while”,

 $index:1;
@while $index<=10{
.text-#{$index}{
font-size:$index * 5;
}
$index:$index+1;
}

But couldn’t write from FCC page as it seems to interpret at every line. So whenever, I was halfway till my code as below,

$index:1;
@while $index<=10{}

the browser is hanging and I had to close FCC tab and reopen. The reason I feel, since I didn’t give yet the $index:$index+1 line so, it is interpreted as an infinite loop where $index<=10 is always true as it is not incremented yet.

The workaround I did, is, I wrote down the complete code in a separate text editor and pasted in FCC and it worked.

Anybody faced this ? May be we need moderator’s attention.

Cheers…

Thanks for writing such a comprehensive explanation of the bug. This is one that has been identified and discussed (and may be fixed in the upcoming update).

For anyone else looking at this, you can avoid the infinite loop by not adding the closing } until the incrementor is in the body of your while loop

1 Like

Thank you @ArielLeslie for your answer !