0
0
SASSmarkup~5 mins

Functions with parameters in SASS - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a function with parameters in Sass?
A function with parameters in Sass is a reusable block of code that takes inputs (parameters) to perform calculations or return values based on those inputs.
Click to reveal answer
beginner
How do you define a function with parameters in Sass?
Use <code>@function</code> followed by the function name and parentheses containing parameters. Example: <code>@function double($number) { @return $number * 2; }</code>
Click to reveal answer
beginner
Why use parameters in Sass functions?
Parameters let you pass different values to the function each time you use it, making your code flexible and reusable.
Click to reveal answer
beginner
What does this Sass function do?<br><pre>@function add($a, $b) { @return $a + $b; }</pre>
It takes two numbers, $a and $b, and returns their sum.
Click to reveal answer
beginner
How do you call a Sass function with parameters?
Use the function name followed by parentheses with arguments. Example: width: add(10px, 5px); calls the add function with 10px and 5px.
Click to reveal answer
How do you define a function with parameters in Sass?
Afunction name($param) { ... }
B@mixin name($param) { ... }
Cdef name($param) { ... }
D@function name($param) { ... }
What does the parameter in a Sass function do?
AImports another Sass file
BStores a value passed to the function
CCreates a new CSS selector
DDefines a CSS property
What keyword returns a value from a Sass function?
Areturn
Byield
C@return
Doutput
How do you call a function named 'multiply' with parameters 3 and 4 in Sass?
Amultiply(3, 4)
B@include multiply(3, 4)
Cmultiply 3, 4
D@function multiply(3, 4)
Which of these is NOT true about Sass functions with parameters?
AThey create CSS selectors
BThey can return values
CThey can take multiple parameters
DThey help reuse code
Explain how to create and use a function with parameters in Sass.
Think about how you pass ingredients to a recipe and get a dish back.
You got /4 concepts.
    Why are parameters useful in Sass functions? Give an example.
    Imagine a calculator that can add any two numbers you give it.
    You got /3 concepts.