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

Misty Majewski
Misty Majewski
5,276 Points

Sass help

Question is "write a function called double that multiplies it's input by two.

I have no idea where to start, couldn't even find a video explaining how to make it double by two?

This is what I tried @function double { $input * 2 }

1 Answer

Airrick Dunfield
Airrick Dunfield
18,921 Points

You're on the right track, but have forgotten a few key aspects on how functions work.

in Sass the syntax for a function is @function NAME($VARIABLE) { CODE; };

Then to use the code..

selector {

property: NAME(??px/em/etc);


I've provided an example for you on codepen: http://cdpn.io/bGdlC