Use @if and @else to Add Logic To Your Styles isn't working

Use @if and @else to Add Logic To Your Styles isn't working
0.0 0

#1

Tell us what’s happening:
I am not able to complete the following test when I run the code: “Your mixin should have an @if statement to check if $val is light, and to set the border to 1px solid black.” Can anyone help me understand why the if statement isn’t working? Thanks.

Your code so far


<style type='text/sass'>
  @mixin border-stroke($val) {
    @if $val == light {
      border: lpx solid black; 
    }
    @else if $val == medium {
      border: 3px solid black;
    }
    @else if $val == heavy {
      border: 6px solid 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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 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


#2

Hint: Count the number of opening { and closing }. You are missing one }.


#3

The issue persists when I match up the braces.


#4

Post your code again. When you enter a code block into the forum, precede it with a line of three backticks and follow it with a line of three backticks to make easier to read. See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.


#5

You also have a typo on this line above.