Recall & Review
beginner
What does the
@return statement do in Sass?It sends a value back from a Sass function to where the function was called. This lets you use the result in your styles.
Click to reveal answer
beginner
How do you write a simple Sass function that returns a color?
You define the function with
@function, then use @return to send back the color.<br>@function primary-color() {<br> @return #3498db;<br>}Click to reveal answer
intermediate
Can
@return send back any type of value in Sass?Yes, it can return colors, numbers, strings, lists, maps, or booleans from a function.
Click to reveal answer
intermediate
What happens if a Sass function does not have a
@return statement?The function returns
null by default, which means no value is sent back.Click to reveal answer
beginner
Why is
@return important in Sass functions?It lets you create reusable code that calculates values once and sends them back to use anywhere in your styles.
Click to reveal answer
What keyword do you use in Sass to send a value back from a function?
✗ Incorrect
The
@return keyword is used to send a value back from a Sass function.What type of value can
@return NOT send back in Sass?✗ Incorrect
@return can send back colors, numbers, strings, lists, maps, and booleans, but not functions themselves.What happens if a Sass function has no
@return statement?✗ Incorrect
Without
@return, a Sass function returns null by default.Where do you use the value sent back by
@return?✗ Incorrect
The returned value is used where the function is called in your Sass code.
Which of these is a correct way to return a value in a Sass function?
✗ Incorrect
In Sass, you use
@return followed by the value and a semicolon.Explain how the
@return statement works in Sass functions and why it is useful.Think about how functions give back results to use later.
You got /4 concepts.
Write a simple Sass function that returns a color using
@return and describe what happens when you call it.Start with @function, then @return the color.
You got /4 concepts.