- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Semicolon Conventions in Lua Programming
There are very few sections we will explore the possibility of making use of a semicolon in Lua. Majority of the code doesn’t require it, while there are some cases where we might need them.
Example
Let’s consider a case where the use of semicolon seems necessary. Consider the example shown below −
local a,b=10,20 print(a+b)
The above statement in Lua is perfectly valid and it works like a charm.
Output
30
Example
What if we change the code above and put it in the same line? Would it still be a valid Lua code? Let’s try it out. Consider the code shown below −
local a,b =10,20 print(a+b)
The above code in Lua will still work as expected but it doesn’t seem very user friendly and that’s where the use of a semicolon will come in handy.
Example
Consider the example shown below −
local a,b =10,20;print(a+b)
Output
30
- Related Articles
- Lexical Conventions in Lua Programming
- Comments in Lua Programming
- table.pack() function in Lua programming
- table.unpack() function in Lua programming
- math.ceil() function in Lua programming
- math.floor() function in Lua programming
- math.max() function in Lua programming
- math.modf() function in Lua programming
- select() function in Lua programming
- Sort function in Lua programming
- string.byte() function in Lua programming
- string.char() function in Lua programming
- string.format() function in Lua programming
- string.gsub() function in Lua programming
- string.lower() function in Lua programming

Advertisements