Skip to content

Commit e5dbb55

Browse files
Add type checking docs
1 parent 483b732 commit e5dbb55

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

docs/language/casting.md renamed to docs/language/type-casting.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
sidebar_position: 50
33
---
44

5-
# Casting
5+
# Type Casting
6+
7+
## Casting
68

79
```mew
810
// This line declares a variable `i` and initializes
@@ -13,7 +15,5 @@ let i: any = 32;
1315
1416
// This line attempts to cast the value stored in `i` to the
1517
// data type `i32` which is a signed 32-bit integer.
16-
let j= i as i32;
17-
```
18-
19-
In summary, casting in this code snippet involves converting a value from the generic `any` type to the specific `i32` type, ensuring that the variable `j` is of the desired data type. This casting operation is possible because the original value in `i` is compatible with the target data type `i32`.
18+
let j = i as i32;
19+
```

docs/language/type-checking.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
sidebar_position: 55
3+
---
4+
5+
# Type Checking
6+
7+
```mew
8+
let i: any = 32;
9+
let j: i is int;
10+
```

docs/language/types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sidebar_position: 80
2+
sidebar_position: 40
33
---
44

55
# Types

0 commit comments

Comments
 (0)