Unlike languages like JavaScript, Sass uses words rather than symbols for its boolean operators.
not <expression>
returns the opposite of the expression’s value: it turns true
into false
and false
into true
.<expression> and <expression>
returns true
if both expressions’ values are true
, and false
if either is false
.<expression> or <expression>
returns true
if either expression’s value is true
, and false
if both are false
.Anywhere true
or false
are allowed, you can use other values as well. The values false
and null
are falsey, which means Sass considers them to indicate falsehood and cause conditions to fail. Every other value is considered truthy, so Sass considers them to work like true
and cause conditions to succeed.
For example, if you want to check if a string contains a space, you can just write string.index($string, " ")
. The string.index()
function returns null
if the string isn’t found and a number otherwise.
Some languages consider more values falsey than just false
and null
. Sass isn’t one of those languages! Empty strings, empty lists, and the number 0
are all truthy in Sass.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4