初始化内容
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
// 函数调用
|
||||
print "函数调用"
|
||||
print("函数调用")
|
||||
|
||||
// 局部变量
|
||||
a
|
||||
b = 1
|
||||
print a
|
||||
print b
|
||||
|
||||
// 自定义函数
|
||||
function fn_a =
|
||||
{
|
||||
a = param[0]
|
||||
b = param[1]
|
||||
return a + b
|
||||
}
|
||||
c = fn_a
|
||||
print c
|
||||
|
||||
// 作用域、全局变量
|
||||
{
|
||||
local_var = 1
|
||||
g_global_var = 2
|
||||
}
|
||||
assert is_null local_var
|
||||
assert !is_null g_global_var
|
||||
|
||||
// 循环
|
||||
i = 0
|
||||
while true
|
||||
{
|
||||
print i
|
||||
++i;
|
||||
if i > 5 break
|
||||
}
|
||||
|
||||
for (j = 0, j < 5, ++j)
|
||||
{
|
||||
print _j
|
||||
}
|
||||
|
||||
// 类
|
||||
class Dot
|
||||
{
|
||||
x
|
||||
y
|
||||
function Print =
|
||||
{
|
||||
print fmt("{},{}", x, y)
|
||||
}
|
||||
}
|
||||
dot = new Dot
|
||||
dot.x = 100
|
||||
dot.y = 200
|
||||
dot.Print()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user