File tree 1 file changed +10
-8
lines changed
docs/source/getting-started
1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -102,17 +102,19 @@ structs (which we'll discuss later).
102
102
103
103
### Type casting
104
104
105
- These types can be passed to/from Inko types:
106
-
107
- ``` inko
108
- let a = 42 as Int32 # => Int32
109
- let b = a as Int # => Int
110
- ```
111
-
112
105
Inko doesn't perform implicit type casts, so passing an ` Int32 ` when a ` Int64 `
113
106
is expected will result in a compile-time error. Similarly, pointers of type
114
107
` Pointer[A] ` aren't implicitly compatible with pointers of type ` Pointer[B] ` ,
115
- and instead require an explicit type cast.
108
+ and instead require an explicit type cast, e.g:
109
+
110
+ ``` inko
111
+ fn example(pointer: Pointer[Cat]) {}
112
+
113
+ let a = 0x123 as Pointer[Dog]
114
+
115
+ example(a) # => invalid
116
+ example(a as Pointer[Cat]) # => valid
117
+ ```
116
118
117
119
## Importing libraries
118
120
You can’t perform that action at this time.
0 commit comments