Sass variable-exists() Function

Last Updated:

Sass variable-exists() Function

The variable-exists() function returns whether a variable named $name (without the $) exists in the current scope.

Example

SASS TO CSS CONVERTER
//Check your console @debug variable-exists("var1"); // false $var1: '#8c8c8c'; @debug variable-exists("var1"); // true p{ // $var2 is local. $var2: 'red'; @debug variable-exists("var2"); // true }

Syntax

variable-exists($name)

Parameter Value

ValueTypeExplanation
$name Required Specifies a variable name.

Return Value

ValueExplanation
bool Returns whether a variable named $name (without the $) exists in the current scope.

Share this Page

Meet the Author