lua怎么判断字符串是否相等

Lua
1380
2023/11/19 14:58:50
栏目: 编程语言
开发者测试专用服务器限时活动,0元免费领,库存有限,领完即止! 点击查看>>

在Lua中,可以使用"=="运算符来判断两个字符串是否相等。例如:

local str1 = "hello"
local str2 = "world"

if str1 == str2 then
    print("字符串相等")
else
    print("字符串不相等")
end

在这个示例中,由于str1和str2的值不相等,所以会输出"字符串不相等"。

辰迅云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>

推荐阅读: Lua怎么与数据库进行交互