类型转换

数字类型转换通过使用类型来执行:

  1. var
  2. x: int32 = 1.int32 # 与调用int32(1)相同
  3. y: int8 = int8('a') # 'a' == 97'i8
  4. z: float = 2.5 # int(2.5)向下取整为2
  5. sum: int = int(x) + int(y) + int(z) # sum == 100