SASS provides and support a variety of useful operators in order to work with different values. These operators consists of the standard mathematical operators like +, -, / and * and apart from them operators of various other types listed below:
- +, -, *, / and % have their usual meaning of mathematics for the numbers with special behavior for some units that matches the behavior of using units in the scientific math.
- == and != operators are used to check weather two values are equal or not.
- <, <=, > and >= are the operators used to compare the two value for greater than and less then results.
- AND, OR and NOT follow the usual boolean behavior. In SASS every value is considered “TRUE” except for false and NULL.
- +, – and / can also be used to concatenate two or more strings.
Order Of Operations:
SASS follows the most standard order of operators that is from tightest to loosest.
- The unary operators: NOT, +, – and /.
- The /, * and % operators.
- The + and – operators.
- The <, <=, > and >= operators.
- The == and != operators.
- The AND operator.
- The OR operator.
- The = operator when it is available.
@debug true or false and false == true or (false and false)chevron_right
Apart from the common order of the operators, their order can be explicitly changed using parentheses. An operation written inside the parentheses is always executed before the operators written outside of it. Parentheses can also be nested. In the case of nested parentheses, the innermost parentheses are executed first.
@debug (2 + 3) * 4chevron_right
@debug ((2 + 3) - 1) * 5chevron_right
- Sass sass:list Module
- Sass sass:color Module
- Sass | sass:map module
- SASS sass:string Module
- SASS | Booleans and Boolean operators
- SASS | Numeric operators
- SASS | Equality Operators
- SASS | Relational Operators
- SASS | String Operators
- How to create optional arguments for a SASS mixin?
- Sass @function Rule
- CSS Preprocessor | SASS
- How to calculate percent minus px in SASS ?
- SASS | Comments
- SASS | Variables
- SASS | @import
- SASS | Nesting
- SASS | Interpolation
- SASS | Placeholder Selectors
- SASS | Parent Selector
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.