Conditionals in Sass

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

Can`t figure out ow to fix this.
<Below this line, add a link to the EXACT exercise that you are stuck at.>
https://www.codecademy.com/en/courses/learn-sass/lessons/functions-and-operations/exercises/if-vs-if

<In what way does your code behave incorrectly? Include ALL error messages.>
The problem is: $i variable is undefined

```

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

.ray {
height: 30px;
width: if($i % 2 == 0, 300px, 350px);
margin-left: if($i % 2 == 0, 0px, 50px);
}

//Add your for-loop here:
@for $i from 1 through $total{
.ray:nth-child(#{$i}){
background: adjust-hue(blue, $i * $step);
}
}

<do not remove the three backticks above>

$i is defined inside of the for loop. If you are going to use the $i variable for your width and margin-left, then you are going to have to put those two inside your for loop. See where the background property line is? Add them after that.

1 Like

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