Sass: Apply a Style Until a Condition is Met with @while -stumped

Sass: Apply a Style Until a Condition is Met with @while -stumped
0

#1

I’ve been moving along well with SASS but I’m stuck at using the while statement.
Thanks for any help

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

<style type='text/sass'>
  $x: 1;
  @while $x < 11{
    .text-#{$x}{font-size: 5px * $i;}
    $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>

#2

Only two small mistakes are failing your test!

The first one is that you didn’t give a dollar sign to tell the compiler that you are declaring a variable: $x

And then, you declared $x, but then you used $i.

By fixing these, you will get that beautiful green window on your screen.


#3

Thanks worked perfectly


#4

You’re welcome.

Good Luck & Happy Coding.