Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
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
Advertisements
