Bug Sass with @while both browser and tests

Bug Sass with @while both browser and tests
0
#1

Hey there,

First, the browser kept freezing as I was writing my code. It seemed to freeze up right about when I had gotten to this point:

$i: 1;

@while $i < 11 {
    
}

I dunno if there was some kind of behind-the-scenes loop going on (I know some kind of extra processing is going on behind the scenes, as sass doesn’t usually go inside style tags and the styles are updating live on the page, and at that point I hadn’t incremented my variable), but typing out the framework and then filling it in is my normal procedure when writing code so that’s a bit of a bummer.

I ended up typing out the guts first (including incrementing my variable), and then putting them inside brackets, and only adding the while bit last, which did work but seems like a hell of a workaround :stuck_out_tongue:


I encountered another problem once I managed to get the code typed out without freezing the browser: it looked fine but failed to pass one of the tests. The test was claiming that the text-1 class didn’t have a font-size of 5px. However, upon inspection, it definitely did :woman_shrugging:

So if the devs have a bit of time to take a look at this topic, that would be great :slight_smile:

#2

It’s not a behind the scenes loop, it’s the while loop in your code. The code entered in the editor runs automatically, so when you create an infinite loop (like the one in the code above) the browser will crash. If you create the exit condition before closing the loop body, you will not see any issues.