官术网_书友最值得收藏!

Concatenate strings

Two strings can be concatenated by placing a .. symbol between them. It is very important to have at least one space on both the left and right of the .. symbol. Concatenating two strings results in a new string, which can be stored in a variable or used in its place. Any combination of variables and literals can be concatenated, as the following code demonstrates:

name = "Mike"
color = "Blue"
-- Concatenate three strings
print ("Jill " .. "likes" .. " Red")
-- Concatenate a variable and a strings
print ("Jack dislikes " .. color)
-- Concatenate two variables and a string
print (name .. " likes " .. color)
-- Concatenate only variables
print (name .. color)
-- Assign result to variable
message = name .. " likes " .. color
print (message)
主站蜘蛛池模板: 安岳县| 乌什县| 当雄县| 老河口市| 白沙| 二连浩特市| 策勒县| 香港| 同江市| 易门县| 尼勒克县| 东阿县| 广昌县| 德化县| 绥化市| 大城县| 东兰县| 大同市| 晴隆县| 永顺县| 建瓯市| 台东县| 徐州市| 务川| 绿春县| 宁远县| 图木舒克市| 武胜县| 盱眙县| 庆阳市| 离岛区| 辉县市| 阿鲁科尔沁旗| 安泽县| 密山市| 梧州市| 鄂托克旗| 邢台县| 资中县| 都兰县| 津南区|