VC: update docs
This commit is contained in:
@@ -12,7 +12,7 @@ Primary expressions are the starting point of any logic chain. These include lit
|
||||
|
||||
```mist
|
||||
let x = 42;
|
||||
let y = Math::PI;
|
||||
let pi = Math::PI;
|
||||
let coordinates = (10, 20, 30);
|
||||
```
|
||||
|
||||
@@ -72,9 +72,11 @@ let content = fs::read_to_string(path)?;
|
||||
|
||||
### Range Operators
|
||||
|
||||
Ranges use spaced `..` syntax:
|
||||
|
||||
```mist
|
||||
0..10 // exclusive range (0 to 9)
|
||||
0..=10 // inclusive range (0 to 10)
|
||||
0 .. 10 // exclusive range (0 to 9)
|
||||
0 ..= 10 // inclusive range (0 to 10)
|
||||
```
|
||||
|
||||
### Arrays
|
||||
@@ -108,6 +110,17 @@ let is_equal = (x == y);
|
||||
let complex = (a + b) * (c / d);
|
||||
```
|
||||
|
||||
## Closures
|
||||
|
||||
Closures use arrow syntax with optional type annotations:
|
||||
|
||||
```mist
|
||||
let add = (a, b) => a + b;
|
||||
let greet = (name str&) => {
|
||||
println!("Hello {}", name);
|
||||
};
|
||||
```
|
||||
|
||||
## Operator Table
|
||||
|
||||
| Category | Operators |
|
||||
@@ -126,3 +139,4 @@ let complex = (a + b) * (c / d);
|
||||
- **Macro Integration**: Macros use `!` as a postfix operation.
|
||||
- **Type Casting**: `as Type` provides explicit type conversion at the expression level.
|
||||
- **Error Propagation**: The `?` operator enables early returns for `Result`/`Option` types.
|
||||
- **Arrow Closures**: `(params) => expr` for concise anonymous functions.
|
||||
|
||||
Reference in New Issue
Block a user