Symbol binding, statements, and calling methods are related to Q# constructs in the programming language. Statement types are listed as below.
- Declaration
- Expression
- Selection
- Iteration
- Jump
- Exception handling
- Checked and UnChecked
- Labeled
- Empty
The Q# symbols are of the following types:
- Mutable
- Immutable
Mutable symbol can be modified after it is bound. Mutable symbol value is declared as shown below:
mutable j=9
The above statement binds j
as an integer with value 9
.
For changing the value of a mutable symbol, set
keyword is used. The example is shown below:
set j = 10;
The above statement will update the value of the variable j
to 10
.
Immutable symbols are declared with let expression. An immutable symbol cannot be modified after it is bound.
let j = 9;
The above statement will bind the symbol j
as an integer with value 9
.