Hello guys,
I am coming from a PHP programming background, just started learning Corona and kind of I am loving it. When review some sample codes and in some tutorials, I see some lines end with semicolon , but some lines don’t.
When should we add semicolon at the end of the line?
for example, in sample codes, in SampleCode/Physics/EggBreaker/main.lua
we have this code
local arrow = display.newImage( "arrow.png", 50, 120 ) game:insert( arrow );
Why the first line doesn’t have semicolon, but second line has semicolon?
Thanks for your help
rob
December 10, 2013, 3:23am
3
The semi-colon is only required if you are putting multiple statements on one line:
a = 10; b = 20; c = 30
This will frequently be needed when doing closures/anonymous functions:
transition.to(myObj, { alpha=0; onComplete=function(target) target:removeSelf(); target = nil; end })
Other than that, they are optional.
Rob
Thank you so much guys, that’s what I was looking for
This forum is awesome, very fast replying.
Cheers,
Andy
rob
December 10, 2013, 3:23am
6
The semi-colon is only required if you are putting multiple statements on one line:
a = 10; b = 20; c = 30
This will frequently be needed when doing closures/anonymous functions:
transition.to(myObj, { alpha=0; onComplete=function(target) target:removeSelf(); target = nil; end })
Other than that, they are optional.
Rob
Thank you so much guys, that’s what I was looking for
This forum is awesome, very fast replying.
Cheers,
Andy