0
0
SASSmarkup~10 mins

Functions with parameters in SASS - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define a function named double that takes one parameter n.

SASS
@function double($n) {
  @return $n [1] 2;
}
Drag options to blanks, or click blank then click option'
A+
B*
C-
D/
Attempts:
3 left
💡 Hint
Common Mistakes
Using + instead of * will add 2 instead of doubling.
Using / will divide instead of multiply.
2fill in blank
medium

Complete the code to call the function double with argument 5.

SASS
$result: double([1]);
Drag options to blanks, or click blank then click option'
An
Bdouble
C5
D$n
Attempts:
3 left
💡 Hint
Common Mistakes
Using the parameter name n instead of a value.
Using the function name double as argument.
3fill in blank
hard

Fix the error in the function by completing the missing operator to subtract 1 from $x.

SASS
@function decrease($x) {
  @return $x [1] 1;
}
Drag options to blanks, or click blank then click option'
A-
B+
C*
D/
Attempts:
3 left
💡 Hint
Common Mistakes
Using + will add 1 instead of subtracting.
Using * or / will multiply or divide instead of subtracting.
4fill in blank
hard

Fill the blank to create a function scale that multiplies $value by $factor.

SASS
@function scale($value, $factor) {
  @return $value [1] $factor;
}
Drag options to blanks, or click blank then click option'
A*
B+
C-
D/
Attempts:
3 left
💡 Hint
Common Mistakes
Using + or - will add or subtract instead of multiplying.
Using / will divide instead of multiply.
5fill in blank
hard

Fill both blanks to create a function adjust that adds $offset to $base and then divides by $divider.

SASS
@function adjust($base, $offset, $divider) {
  @return ($base [1] $offset) [2] $divider;
}
Drag options to blanks, or click blank then click option'
A+
B-
C/
D*
Attempts:
3 left
💡 Hint
Common Mistakes
Using - instead of + for addition.
Using * instead of / for division.