|
| 13 Apr 2014 05:24 PM |
Why do people have their variables like this?
variable1 = 5; variable2 = 10; variable3 = 20; variable4 = 40; variable5 = 80; |
|
|
| Report Abuse |
|
|
|
| 13 Apr 2014 05:27 PM |
because semi-colons are for bosses
#nerdsunited |
|
|
| Report Abuse |
|
|
| |
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 13 Apr 2014 05:30 PM |
| because most other languages require them and they're used to it |
|
|
| Report Abuse |
|
|
gamehero
|
  |
| Joined: 12 Jun 2007 |
| Total Posts: 1455 |
|
|
| 13 Apr 2014 05:31 PM |
| Usually it's out of habit from C++, because it doesn't run when you forget them. But that's not the case for Lua. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 13 Apr 2014 05:34 PM |
'Usually it's out of habit from C++' No, there are so many other languages people use that require them. So many. |
|
|
| Report Abuse |
|
|
| |
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 13 Apr 2014 05:41 PM |
Not much in Lua, though in some cases it does. Like:
x = 5;y=10 works but x=5y=10 doesn't |
|
|
| Report Abuse |
|
|
gamehero
|
  |
| Joined: 12 Jun 2007 |
| Total Posts: 1455 |
|
|
| 13 Apr 2014 05:42 PM |
| Yeah, it doesn't matter. Although some people may criticize you for using semicolons in Lua, because of how unnecessary they are. |
|
|
| Report Abuse |
|
|
| |
|
gamehero
|
  |
| Joined: 12 Jun 2007 |
| Total Posts: 1455 |
|
|
| 13 Apr 2014 05:49 PM |
However... It may be good practice to use semicolons like this though... You can see the breaks between the inner tables better.
t = {{0,0,0,0};{1,2,3,4};{8,2,3,7}}
Instead of this... t = {{0,0,0,0},{1,2,3,4},{8,2,3,7}}
But it's very minor... |
|
|
| Report Abuse |
|
|
|
| 13 Apr 2014 05:50 PM |
Semicolons are aesthetically pleasing, and are required in most other languages (esp. Java- and C-based languages). To have people learn to use semicolons this early into a programming career, assuming they would like to get into a career along this line, would help them a lot. |
|
|
| Report Abuse |
|
|
oxcool1
|
  |
| Joined: 05 Nov 2009 |
| Total Posts: 15444 |
|
|
| 13 Apr 2014 06:45 PM |
In Lua, semicolons can be used to fix 'ambiguous errors'.
Ex:
print("test") (print)("Hi")
> error: ambiguous syntax (function call x new statement) near '('
print("test"); (print)("Hi")
> test > Hi |
|
|
| Report Abuse |
|
|
|
| 13 Apr 2014 06:45 PM |
| It's a habit from Java and PHP and C++ and other languages like that. |
|
|
| Report Abuse |
|
|
|
| 13 Apr 2014 07:07 PM |
I'm a PHP programmer. PHP requires semicolons to successfully compile a web application. Semicolons don't matter much in Lua; but as cntkillme said, they may when you're using the Studio Command Bar.
- InternalSequence *Web Developer* |
|
|
| Report Abuse |
|
|
|
| 13 Apr 2014 07:36 PM |
"Although some people may criticize you for using semicolons in Lua, because of how unnecessary they are."
Those morons aren't real programmers and cannot seek a future in software engineering or anything to do with any kind of programming/scripting language in a computer.
@OP You can use semicolons to separate key-value pairs in a table and get the same results as using an ordinary comma. |
|
|
| Report Abuse |
|
|