Created
February 3, 2021 13:29
-
-
Save leveled/a4955ad975a15a9ce7f0bc944a0c70e7 to your computer and use it in GitHub Desktop.
Type conversion in Nim
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var | |
x: int32 = 1.int32 # same as calling int32(1) | |
y: int8 = int8('a') # 'a' == 97'i8 | |
z: float = 2.5 # int(2.5) rounds down to 2 | |
sum: int = int(x) + int(y) + int(z) # sum == 100 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment