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 trial

CSS Sass Basics (retired) Speeding up Workflow with Sass Sass Functions

Tanca-Sanquer Gigel
Tanca-Sanquer Gigel
6,562 Points

Help i don't understand

I have to return an input in a function and i don't know how.

index.html
<!DOCTYPE html>
<html>
<head>
  <title>Sass Basics - Code Challenge</title>
  <link rel="stylesheet" type="text/css" href="page-style.css">
  <link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
  <div>
    <p>
      Bacon ipsum dolor sit amet biltong capicola meatball, corned beef venison tongue meatloaf ham sausage jerky short loin bacon. Shoulder pork pig, pancetta turducken flank strip steak prosciutto jerky venison.
    </p>
    <p>
      Ground round bacon pig ribeye biltong capicola jerky prosciutto sirloin. Hamburger turducken corned beef leberkas andouille, shoulder pork shank strip steak biltong flank meatball pancetta chicken.
    </p>
  </div>
</body>
</html>
style.scss
/* Write your SCSS code below. */
@function double($input) {
  @return  unquote ($input x2;)
}

5 Answers

Hi there,

You're pretty much there. But the asterisk is used to multiply numbers, not a lowercase x.

And you don't need the brackets around the returned item (and the semi-colon would be outside of any brackets):

@function double($input) {
  @return $input * 2;
}

I hope that helps,

Steve.

Tanca-Sanquer Gigel
Tanca-Sanquer Gigel
6,562 Points

Thank you very much,you are awesome!

Hey, no problem! Glad you got it sorted. :+1:

Steve.

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,253 Points

I've investigated this for you, and although it's been too long since I've looked as Sass and I tell you what's happening and how you can fix it.

You're nearly there.

But you're trying to return the value in brackets as if it were a method. But all you need a reference to the function argument, that is $input and then of course multiply it,.

So just give the return the variable as below.

/* Write your SCSS code below. */
@function double($input) {
  @return  $input x2);

}

Good luck :)

Tanca-Sanquer Gigel
Tanca-Sanquer Gigel
6,562 Points

Oh boy :{ Sass is definetly not for me :D

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,253 Points

Nooo, you can do it! :)

I don't use Sass as often as I should to be honest but as you get further into it, you'll be able to see how good it is for writing CSS code that doesn't repeat itself... at least when you're writing it. :-)

Tanca-Sanquer Gigel
Tanca-Sanquer Gigel
6,562 Points

Thank you for encouraging me! I'm really kean on finishing my webdesign course,and Sass is the last module.I find it really hard to understand most of the time.