Expressions
An expression is a sequence of variables and literals, punctuated by operators. A literal is an explicit data value, such as 1 for an integer or 2.1 for a floating-point number. Literals are often used to assign a value to a variable.
An expression followed by a semicolon (;) is called a statement. Statements range in complexity from simple expressions to blocks of statements that accomplish a sequence of actions. Flow-control statements determine the order statements are executed.
A statement block also indicates subscope. Variables declared within a statement block are only recognized within the block. HLSL statements determine the order in which expressions are evaluated. Each expression can be one of the following.
- An expression
- A statement block
- A return statement
- A flow-control statement
Related topics