@while Sass challenge keeps crashing

**My browser tab keeps crashing after typing the while statement: **

$i: 1;
@while $i < 11

trying to follow this

@while $x < 13 {
  .col-#{$x} { width: 100%/12 * $x;}
  $x: $x + 1;
} 

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/front-end-libraries/sass/apply-a-style-until-a-condition-is-met-with-while/

What’s happening: You’re giving a variable ($i in this case), an initial value of one; then creating a loop that checks every time the value of $i until it reaches 11; which never happens… It goes on a forever loop until it crashes the browser.

How to fix: Don’t specify the initial value of $i until you didn’t write the rest of the code, because the output will keep refreshing automatically, resulting in this issue.

1 Like