0
0
SASSmarkup~5 mins

Functions vs mixins comparison in SASS - Quick Revision & Key Differences

Choose your learning style9 modes available
Recall & Review
beginner
What is a function in Sass?
A function in Sass is a reusable block of code that returns a single value, like a color or number, which you can use in your styles.
Click to reveal answer
beginner
What is a mixin in Sass?
A mixin is a reusable block of styles that you can include in other selectors. It can add multiple CSS properties at once.
Click to reveal answer
intermediate
How do functions and mixins differ in what they output?
Functions return a single value (like a color or number), while mixins output CSS rules directly into your stylesheet.
Click to reveal answer
beginner
Can mixins accept parameters in Sass?
Yes, mixins can take parameters to customize the styles they add, making them flexible and reusable.
Click to reveal answer
intermediate
When should you use a function instead of a mixin in Sass?
Use a function when you need to calculate and return a value to use inside other CSS properties, not to output styles directly.
Click to reveal answer
What does a Sass function return?
AA single value like a color or number
BMultiple CSS rules
CAn HTML element
DNothing, it just runs code
Which Sass feature outputs CSS rules directly into your stylesheet?
AMixin
BFunction
CVariable
DPlaceholder selector
Can mixins accept parameters to customize their output?
AOnly functions can
BYes
CNo
DOnly variables can
When should you use a Sass function?
ATo output multiple CSS rules
BTo define variables
CTo calculate and return a value
DTo include HTML code
Which of these is NOT true about Sass mixins?
AThey help avoid repeating code
BThey can include multiple CSS properties
CThey can accept parameters
DThey return a single value
Explain the main differences between Sass functions and mixins.
Think about what each one outputs and how you use them in your styles.
You got /5 concepts.
    Describe a situation where you would choose a mixin over a function in Sass.
    Consider when you want to add actual CSS code, not just a value.
    You got /4 concepts.