Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS Advanced Sass Advanced Variables, Mixins, Functions, and Placeholders Null Options and Arguments

Chris Shaw
Chris Shaw
26,650 Points

Misleading quiz

Hi,

I'm simply going through the advanced Sass course just to see if there's anything I've missed and have come across a quiz where 2 answers are correct in the context of the question which is as follows.

When you are building a mixin and you have arguments that are optional, which of the following patterns will work?

Both answers below are correct

@mixin foo($color, $width: false, $height: false)
@mixin foo($color, $width: null, $height: null)

In context the question only asks which have optional arguments not optional CSS properties, given the context of the video before it the second mixin is correct but again that's not the question.

Just something I picked up on.

Chris Shaw
Chris Shaw
26,650 Points

Also the extends challenge doesn't tell you what to you with the code, I had to fail on purpose just to see what was required.

https://dl.dropboxusercontent.com/u/54218996/question-error.png

4 Answers

Andrew McCormick
Andrew McCormick
17,729 Points

Regarding the quiz: While the page will still render with using 'false', it will also render the CSS with 'false' as the property value which is invalid (browsers are just smart enough to be ok with it). Where as when you use null, the property is left off completely. sass mixin

As for the extends challenge, are you talking about this one: http://teamtreehouse.com/library/advanced-sass/advanced-variables-mixins-functions-and-placeholders/extends ?

Chris Shaw
Chris Shaw
26,650 Points

Regarding the quiz: While the page will still render with using 'false', it will also render the CSS with 'false' as the property value which is invalid (browsers are just smart enough to be ok with it). Where as when you use null, the property is left off completely.

I understand that but in Sass logic both answers are correct, the question asks about arguments which is different in context compared to CSS properties as I mentioned above, the answers for the quiz should only be in context to the video itself as I almost pressed the answer using false because that's how I naturally write my Sass code.

As for the extends challenge, are you talking about this one: http://teamtreehouse.com/library/advanced-sass/advanced-variables-mixins-functions-and-placeholders/extends ?

Yep, I forgot to post the link, it simply needs to be clarified what the task is otherwise you have no idea until you check your code.

Dale Sande
STAFF
Dale Sande
Treehouse Guest Teacher

Hi Chris -

You are correct, using either false or null, the Sass will process to CSS, but as Andrew pointed out, the use of false is a string value being assigned to a variable and this will be output as CSS and this will be invalid CSS.

So, the correct answer would be null as this is NOT a string value and Sass will ignore and move on.

Chris Shaw
Chris Shaw
26,650 Points

But again, that's not the question in the challenge.

When you are building a mixin and you have arguments that are optional, which of the following patterns will work?

In my head the question should be worded as follows.

When you are building a mixin and you have properties that are optional, which of the following patterns will work?

To me the keyword properties defines the question correctly.

Elizabeth Kozup
Elizabeth Kozup
5,223 Points

Hi Chris,

Thanks for your feedback on this! Based on your points, Dale has reviewed the question and updated it for clarity.

We updated the question to: If you are building a mixin that contains arguments with optional values, which of the following patterns will work best?

Hopefully that will clear up any points down the road. Thanks again for your help!