Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAaron Coursolle
18,014 PointsWhy doesn't this work?
/* Write your SCSS code below. */
@function double($input) {
@return unquote(($input * 2) + "px")
}
div {
font-size: double(5);
}
3 Answers
elk6
22,916 PointsHi Aaron,
For the first 2 tasks, this code below is what you need. No need for the unquote thing. Just make the simple function, like this:
/* Write your SCSS code below. */
@function double($input) {
@return $input * 2;
}
Then give the dive the double function with 5px input, like this:
div {
font-size: double(5px);
}
For task 3, just write a declaration like this:
div {
font-size: 10px;
}
Because writing the function is way more work than just declaring it like that.
Steven Parker
231,275 PointsPassed through SCSS preprocessing, this compiles into:
div {
font-size: 10px;
}
I assume that is what you were intending.
What makes you think it's not working? Are you sure you are using a preprocessor for SCSS? Are you checking the font size of text inside <div> elements?
Aaron Coursolle
18,014 PointsHi Steven,
For some odd reason, "unquote" passes the challenge when it's in the font-size declaration, but not when it's in the function (where if you a building a function, it would make more sense).
But Elian is right about what he says about part 3 of the challenge. In real life, we would simply declare something so basic instead of writing a function for it.
Aaron Coursolle
18,014 PointsThis passed:
@function double ($input) {
@return $input * 2
}
div {
font-size: unquote(double(5) + "px");
}
My code, above in the original question, does not.