语言基础
基础类型有下面几种:
| 类型名称 | 描述 |
|---|---|
| uint8 | 8 位无符号整数 |
| uint16 | 16 位无符号整数 |
| uint32 | 32 位无符号整数 |
| uint64 | 64 位无符号整数 |
| int8 | 8 位有符号整数 |
| int16 | 16 位有符号整数 |
| int32 | 32 位有符号整数 |
| int64 | 64 位有符号整数 |
| float32 | 32 位单精度浮点数 |
| float64 | 64 位双精度浮点数 |
| boolean | 布尔值 |
| string | 字符串 |
| 类型名称 | 描述 |
|---|---|
| sequence<T> | 可变长度数组,元素类型为 T |
| map<K, V> | 键值对集合,键类型为 K,值类型为 V |
struct Point { uint32 x; uint32 y;};enum Color { Red, Green, Blue};interface ILogger { void log(string message);};enum Color { Red, Green, Blue};
union ColorPoint switch(Color) { case Red: uint32 red_x; uint32 red_y; case Green: uint32 green_x; uint32 green_y; case Blue: uint32 blue_x; uint32 blue_y; default: uint32 default_x; uint32 default_y;};struct Point { uint32 x; @optional uint32 y;};