Complete the code to define a custom function that returns double the input value.
@function double($number) {
@return $number [1] 2;
}The * operator multiplies the input by 2, doubling it.
Complete the code to call the custom function double with the argument 5.
.box {
width: [1];
}Calling double(5) returns 10, and adding em sets the width in relative units.
Fix the error in the function by completing the return statement to subtract 1 from the input.
@function decrement($num) {
@return $num [1] 1;
}The minus operator - subtracts 1 from the input number.
Fill both blanks to create a function that returns the square of a number minus 1.
@function square($n) {
@return $n [1] $n [2] 1;
}The function multiplies the number by itself and subtracts 1 to return the square minus one.
Fill all three blanks to create a function that returns half the input plus 3.
@function half_plus_three($val) {
@return ($val [1] 2) [2] 3 [3] 0;
}The function divides the value by 2, adds 3, and subtracts 0 (which does nothing but completes syntax).