Use-for-to-create-a-sass-loop

Use-for-to-create-a-sass-loop
0.0 0

#1

Tell us what’s happening:
I can’t get the task solved. It fails on all conditions exept the first. Inspecting the page, I can see the classes properly created and also the preview in fcc page looks fine

Your code so far



<style type='text/sass'>
  
  @for $j from 1 to 6 {
    .text-#{$j} { font-size: 10px*$j; }
  }
  
</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>

Your browser information:

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

Link to the challenge:


#2

When I run your code it passes all the tests. Make try refreshing the page and running the tests again.


#3

Thank you for the answer. If I refresh the page, the code is cleared, so I try pasting the same but tests keep failing:sob:


#4

Finally I got the challenge solved. Honestly I still don’t understand what’s went on…I changed some spaces and carriage return and things “magically” worked fine. Now I have the same problem in the following challenges (the @each and @while. If somebody have the same problem (and maybe a solution to it) please reply.


#5

Same issue, ive been rearranging my white spaces and newlines and still cant seem to get the code to evaluate correctly. Did you get the @each and @while lesson?


#6

Hi guys had the same problem - not passing this challenge. I seem to have temporarily solved/passed it by starting to delete spaces inside the last section of the code: {font-size: 10px*$j;}.

Initially I had spaces after 10px and then another space after the multiplication(*) sign. At some point after deleting these two spaces it passed the test, and it passed using the word “through” instead of “to.”

I say temporarily because when I went back and changed to “1 to 6” it seemed to not pass again…put it back to “through” and passed again.

Definately buggy…

Good luck and happy coding.


#7

I’m getting the impression that however some of these Sass challenges are checked, (Regex?) they aren’t set up to allow for more than 1 exact match. So…perhaps from moving over from the beta site this particular challenge was set up to be “through” and the check didn’t allow for any different spacing?

Then again, on the beta site, I remember I just read through the examples and moved on anyway because they didn’t work there either. The Sass site has great documentation, so this is more of an introduction to what’s available.