source/documentation/syntax/structure.md
A Sass stylesheet is made up of a series of statements, which are evaluated in
order to build the resulting CSS. Some statements may have blocks, defined
using { and }, which contain other statements. For example, a style rule is
a statement with a block. That block contains other statements, such as property
declarations.
In SCSS, statements are separated by semicolons (which are optional if the statement uses a block). In the indented syntax, they're just separated by newlines. While you can use a semicolon at the end of a statement in the indented syntax, a newline is still required.
These types of statements can be used anywhere in a Sass stylesheet:
$var: value.@if and
@each.@error,
@warn, and
@debug rules.These statements produce CSS. They can be used anywhere except within a
@function:
h1 { /* ... */ }.@media and @font-face.@include.@at-root rule.These statements can only be used at the top level of a stylesheet, or nested within a CSS statement at the top level:
@use.@import.@mixin.@function.width: 100px may only be used within style rules and some CSS at-rules.@extend rule may only be used within
style rules.An expression is anything that goes on the right-hand side of a property or
variable declaration. Each expression produces a value. Any valid CSS
property value is also a Sass expression, but Sass expressions are much more
powerful than plain CSS values. They're passed as arguments to mixins and
functions, used for control flow with the @if rule, and manipulated
using arithmetic. We call Sass's expression syntax SassScript.
The simplest expressions just represent static values:
12 or 100px."Helvetica Neue" or bold.#c6538c or blue.true or false.null.1.5em 1em 0 2em, Helvetica, Arial, sans-serif, or
[col1-start].("background": red, "foreground": pink).Sass defines syntax for a number of operations:
{% render 'doc_snippets/operator-list', parens: true %}
$var.nth($list, 1) or
var(--main-bg-color), which may call Sass core library functions or
user-defined functions, or which may be compiled directly to CSS.calc(1px + 100%) or url(http://myapp.com/assets/logo.png), that have their
own unique parsing rules.&.!important, which is parsed as an unquoted string.