8. Conditionals

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>
Hello can someone help me with this?

THANK YOU SO MUCH :kiss:

<In what way does your code behave incorrectly? Include ALL error messages.>
ERROR MESSAGE:
expected div.ray:nth-child(1) to have its width style equal to 350px but got 811px

```

$total: 10; //Number of .ray divs in our html
$step: 360deg / $total; //Used to compute the hue based on color-wheel

.ray {
height: 30px;
}

@for $i from 1 through $total {
.ray:nth-child(#{$i}) {
width: if ($i % 2 == 0, 300px, 350px);
margin-left: if ($i % 2 == 0, 0px, 50px);
background: adjust-hue(blue, $i * $step);

}
}

<do not remove the three backticks above>

Yeah same problem here, guess it is some kind of bug, tried with another browser but still not working :S

Finally Get A Code button work, I got this one passed with next code:

$total: 10; //Number of .ray divs in our html
$step: 360deg / $total; //Used to compute the hue based on color-wheel


.ray {
  height: 30px;
}

//Add your for-loop here:
@for $i from 1 through $total {
    .ray:nth-child(#{$i}){
        background: adjust-hue(blue, $i * $step);
    width: if($i % 2 == 0, 300px, 350px);
        margin-left: if($i % 2 == 0, 0px, 50px);
    }
}

I’ve tried using different browsers and adding the code like you’ve posted but its still an error :cry:

The code supplied in the lesson is incorrect - even after copy/pasting directly I still got an error. It turns out you have to remove the space between the ‘if’ and the open parentheses. It runs with the space removed.

2 Likes

yeah, same error here…

Yea! Thank you so much!!!

So there should never be a space after an if statement in sass?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.