0
0
SASSmarkup~5 mins

@return statement in SASS - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
A@send
B@yield
C@return
D@output
What type of value can @return NOT send back in Sass?
AFunctions
BNumbers
CColors
DStrings
What happens if a Sass function has no @return statement?
AIt returns <code>null</code>
BIt throws an error
CIt returns <code>0</code>
DIt returns the last variable
Where do you use the value sent back by @return?
AInside the function only
BIn comments
CIn a different file only
DWhere the function is called
Which of these is a correct way to return a value in a Sass function?
Areturn 10px;
B@return 10px;
Csend 10px;
D@yield 10px;
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.