跳转到内容

语言基础

基础类型有下面几种:

类型名称描述
uint88 位无符号整数
uint1616 位无符号整数
uint3232 位无符号整数
uint6464 位无符号整数
int88 位有符号整数
int1616 位有符号整数
int3232 位有符号整数
int6464 位有符号整数
float3232 位单精度浮点数
float6464 位双精度浮点数
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;
};