数据类型
控制结构
if
if a == b do_something()
while
while expr
stmt
do-while
do
stmt
while expr;
do
stmt
until expr;
類型定義
const blahblah = type {
foo :i32;
bar :[];
hoge :{};
blah :func (i32) i32;
}
函数定义
/* Global function */
const main = func (argc:i32, args:arr) i32 {
print "hello world";
return 0;
}
/* lambda function */
signal_set_handler(SIGALRM, func (i32) i32 {
var sig = __ARGV[1] /* __ARGV is an pre-defined variable that collect all of the argument passed */
/* __ARGV[0] is */
return 0;
})
/* function bind to a type */
public const blahblah.set_foo = func (i32) i32 {
/* self is an predefined variable pointed to __ARGV[0] */
self.foo = __ARGV[1];
}
模块化