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.



Write a function, named multiply, that takes a value as an argument, then returns that value multiplied by 2.


1 Answer

Kevin Korte
Kevin Korte
28,109 Points

What have you tried so far?

Take a look at the Sass documentation found here: http://sass-lang.com/documentation/file.SASS_REFERENCE.html#function_directives

Every sass function starts with @function, than the function name, and any variables to pass into the function inside parentheses. Inside the curly braces we have to @return something. In this case it's whatever the value we passed in as a variable * 2.

The example function on the Sass docs I linked above shows you exactly the syntax you need. Try plugging in the rest of the specifics of the questions into the syntax and see if you can't get it right.

Let me know how it goes.

my code: lol

@function (multiply)

Kevin Korte
Kevin Korte
28,109 Points

That's a start. I expanded above. Let me know if that helps you solve it for yourself.

my code: whats wrong with it?

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

Kevin Korte
Kevin Korte
28,109 Points

Functions use @return instead of $return

thank u so much