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

Write Sass function called double

Hi guys,

I'm getting stuck in the challenge "speeding up Workflow with Sass". The challenge is: " Write a function, called 'double', that multiplies its input by 2. "

I've tried the following thing: @function double{ @return $input($value * 2); }

Thanks.

6 Answers

Nicholas Wright
Nicholas Wright
17,497 Points

Mardi, you pretty much got it right. You don't need the ( ) or the ; after your @return .

Also, check the rest of your code. I wasn't passing because I had 'fontsize' and not 'font-size'

Tobia Crivellari
Tobia Crivellari
14,331 Points

Hey guys!

Here the right code for it:

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

Cya! :-D

Marguerite Seip
Marguerite Seip
10,762 Points

I was stuck on this too, until I omitted the parentheses around the return value

Alan Sloan
Alan Sloan
15,618 Points

This fixed the issue I was having as well. Thanks!

You're not passing in a parameter. The function must take one parameter (which is the input to double). Then when the function returns a value, just return that parameter * 2. return $input($value * 2) isn't valid code.

Hi guys, getting stuck on this to. I'm sure I had it when I used the following code. Not so lucky..

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

Also I tried it with the 'unquote' function, but that didn't help. Any ideas?

Hi guys, getting stuck on this to. I'm sure I had it when I used the following code. Not so lucky..

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

Also I tried it with the 'unquote' function, but that didn't help. Any ideas?