Conditionals in Sass


Can`t figure out ow to fix this.

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{
    background: adjust-hue(blue, $i * $step);


$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.


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