- Lua Quick Start Guide
- Gabor Szauer
- 133字
- 2021-08-05 10:30:38
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)
推薦閱讀
- Python量化投資指南:基礎(chǔ)、數(shù)據(jù)與實(shí)戰(zhàn)
- Java高并發(fā)核心編程(卷2):多線程、鎖、JMM、JUC、高并發(fā)設(shè)計(jì)模式
- Python入門很簡單
- C語言程序設(shè)計(jì)基礎(chǔ)與實(shí)驗(yàn)指導(dǎo)
- Apache Hive Essentials
- Visual Basic學(xué)習(xí)手冊
- Mathematica Data Analysis
- Mastering Apache Maven 3
- INSTANT Passbook App Development for iOS How-to
- Mastering JBoss Enterprise Application Platform 7
- Nginx實(shí)戰(zhàn):基于Lua語言的配置、開發(fā)與架構(gòu)詳解
- C/C++程序員面試指南
- 智能手機(jī)APP UI設(shè)計(jì)與應(yīng)用任務(wù)教程
- Mobile Forensics:Advanced Investigative Strategies
- jQuery從入門到精通(微課精編版)