DataTypes
Write in front: I am not a native English speaker, and my English is poor. Sorry for that, and if you want help me , just submit PR. Thank you!
Variable declaration
langX is a weak-type script language.
Do not need a specific type.
如果一个变量直接赋值, 则会自动为其声明。
Attention
默认情况下, langX 使用的变量会穿越当前的 调用环境。(下面会详细举例)
可以使用关键字限制这个情况。
Numeric
langX has two numeric types: Integer and Double.
Integer: 1,2,3,500,...
Double: 1.0,0.999,100.661115,...
Code Example:
a = 1;
b = 2;
c = 0.55;
d = 15.66105;String
What is enclosed in double quotation marks is called a string.
Code Example:
Function (lambda expr)
In langX , we use symbol => as the function keyword and lambda keyword.
Code Example:
函数func赋值给变量varFunc之后,varFunc就保存了函数func的引用, 之后就可以通过变量varFunc对函数func进行调用。
而 变量noNameFunc保存的是对lambda表达式的引用。
引用穿透调用环境
在函数调用的默认情况下, 变量是会穿透的。
看下面的代码。
如果你不想他们穿透, 可以考虑使用 local 关键字声明变量, 或者使用restrict 关键字
下面简单介绍一下 restrict 关键字的使用。
Class
Format: ClassName { classBody }
Code Example:
Attention
langX do not have
privatekeyword, all class and all member in class is public.Keyword
extendscan let you extends other class. (More info:scripts/extends1.lx)Type check keyword:
is( More info:scripts/typejudge1.lx)Operators function override is supported.
Keyword
autocan extend the original class content. (More info:scripts/classauto1.lx)
Last updated
Was this helpful?