Sass comparable() Function

Last Updated:

Sass comparable() Function

The comparable() function returns a Boolean value indicates whether number1 and number2 have compatible units.

Example

SASS TO CSS CONVERTER
//Check your console @debug comparable(2px, 1px); // true @debug comparable(100px, 3em); // false @debug comparable(10cm, 3mm); // true

Syntax

comparable($x, $y)

Parameter Value

ValueTypeExplanation
$x Required A number (with or without unit)
$y Required A number (with or without unit)

Return Value

ValueExplanation
boolean Returns whether $x and $y have compatible units.

Share this Page

Meet the Author