zl程序教程

您现在的位置是:首页 >  其它

当前栏目

Lua中..和#运算符的用法

用法 运算符 lua ..
2023-09-14 09:06:20 时间

Lua中..和#运算符的用法


样例

试试以下的样例就明确了在Lua编程语言提供的其它运算符:

a = "Hello "
b = "World"
print("Concatenation of string a with b is ", a..b )
print("Length of b is ",#b )
print("Length of b is ",#"Test" )


当建立并运行上面的程序它会产生下面结果

Concatenation of string a with b is  Hello World
Length of b is  5
Length of b is  4