2015年4月1日 星期三

[Corona SDK] How to add comment?

In C or Java, we just add "//" if we want to comment it.
How about in Corona SDK?
It's simple.
Just add "--" in front of line.

What if we want to make one paragraph as comment?
We can enclose it by "--[[" and "--]]".
--[[
print( 10 ) -- no action (comment)
--]]
Although there is no "--" in front of print(10), it is still the part of comment since it is within "--[[" and "--]]".

What is we want to cancel the comment paragraph?
One method is to remove "--[[" and "--]]".
Another simpler way is to just add "-", especially during your development stage.
---[[
print( 10 ) -- will print
--]]
If you use Sublime Text and with Corona Editor package installed, as described in [Corona SDK] The powerful editor - Sublime Text 2, you can see the change of text color for those commented part.

沒有留言:

張貼留言