Infinite loop in @while exercise

Hello all,

In the exercise “Sass: Apply a Style Until a Condition is Met with @while”, it seems very easy to crash the browser without running the test.

As the website automatically interpret the code to render it, when we start typing the answer, we can arrive to an infinite loop because the code is not finished being typed!

$x: 1;
@while $x < 13 {

}

I was wondering if my understanding is correct (or maybe I’m doing something else wrong) and if maybe there shouldn’t be a clearer warning sign that an infinite loop syntax should be avoided even if the test are not run?

Cheers,
Joel

1 Like

This is an issue and there is ongoing discussion on how to fix it. You can avoid the infinite loop by not adding the closing brace (}) until you have written the body of the loop with the incrementor.

1 Like

Thanks for the answer; good to know there’s ongoing discussion about it; I couldn’t find it while searching.