The function call moves the current state, $σ$ to the new derived state $σ'$ in the function, test()'s context. A function can evaluate void (none), i32 and bool.
A sequence is a composition of commands where the first command is first executed then the second command. Otherwise the intermediate step, $σ'$ would be lost.
\frac{<x, σ>⇓<let \text{ } x:=e, σ>⇓σ'}{<let \text{ } x := e, σ> ⇓ σ[x := e]}
```
```rust
leta:i32=1;
letb:bool=true;
...
...
@@ -292,8 +302,9 @@ let c : i32 = test(); // c will be assigned whaterver test() returns
For let commands, if the variable is already declared the state $σ$ will be changed to the one of the second command, state $σ'$, the variable will be lost. Otherwise the variable will be assigned to the state, $σ$.
Assignment expression
$\frac{}{<x:= e,σ> ⇓ σ[x := e]}$
```math
\frac{}{<x := e, σ> ⇓ σ[x := e]}
```
```rust
x=1;
...
...
@@ -307,8 +318,9 @@ For assignment, when the variable is assigned to a number, boolean or function t
For both if and while commands their block/scope are evluated as long as their condition is evaluted to the type boolean. This differ from the interpreter which only executes the block/scope if the condition is true.
letb:bool=test();// test() must return type bool otherwise Error
...
...
@@ -425,15 +444,17 @@ let b : bool = test(); // test() must return type bool otherwise Error
As previously mentioned, let assignment are unique declerations. Thus, the same variable can not be declared twice in the same scope. Here, the given return type of the variable is checked with rhs evluated type.