Use @if and @else to Add Logic To Your Styles

Tell us what’s happening:

Your code so far


<style type='text/sass'>
  @mixins border-stroke(val) {
    @if $val == light {
      border: 1px black;
    }
    @if $val == medium {
      border: 3px black;
    }
    @if $val == heavy {
      border: 6px black;
    }
    @else {
      border: none;
    }
  }
  
  
  #box {
    width: 150px;
    height: 150px;
    background-color: red;
    @include border-stroke(medium);
  }  
</style>

<div id="box"></div>

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/front-end-libraries/sass/use-if-and-else-to-add-logic-to-your-styles/

What is the problem you’re having?

U miss else before if,and this is my solution:

@mixin border-stroke($val){
@if $val == light{
border:1px solid black;
}
@else if $val == medium {
border:3px solid black;
}
@else if $val == heavy{
border:6px solid black;
}
@else {
border:none;
}
}