Apply a Style Until a Condition is Met with @while font-size condition fails

Tell us what’s happening:
I dunno what’s wrong here…?

Your code so far


<style type='text/sass'>
  $x : 1
  @while $x < 11 {
    .text-#{$x} {
      font-size: 5px * $x;
      }
    
    $x: $x + 1;
  }
  
  
</style>

<p class="text-1">Hello</p>
<p class="text-2">Hello</p>
<p class="text-3">Hello</p>
<p class="text-4">Hello</p>
<p class="text-5">Hello</p>
<p class="text-6">Hello</p>
<p class="text-7">Hello</p>
<p class="text-8">Hello</p>
<p class="text-9">Hello</p>
<p class="text-10">Hello</p>

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 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

You forgot to to close your first line. Give it a semicolon.

1 Like

OMG, are semicolons mandatory here ?
I mean in Javascript, it wouldn’t matter if we close it with semi-colon or leave it…

True in javascript but looks like scss needs semicolons by looking at examples.

That is because JavaScript has ASI
http://2ality.com/2011/05/semicolon-insertion.html

If you don’t like semi-colons you can use the SASS flavor instead of SCSS (not for the lessons of course).

1 Like