Skip to content

Commit 790ab32

Browse files
committed
better typeid example
1 parent 9e744a4 commit 790ab32

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

content/posts/odin-guide.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ a :: int; // a is int
4545
b: a = 1; // b is now an int
4646
```
4747

48+
In Odin `typeid` is a bit of an overloaded term, because there is a difference between a compile time typeid and a runtime typeid.
49+
if it's at compile time, typeid is a type, if it's at runtime, typeid is an integer representing a type
50+
```odin
51+
x :: int // this works, x is a *type*
52+
x := int // error, you'll need to do typeid_of(int)
53+
```
54+
4855
## Loops
4956

5057
**Simple for loops:**

0 commit comments

Comments
 (0)