Comments - jpbubble/NIL-isn-t-Lua GitHub Wiki
Commenting in NIL
NIL uses (unlike Lua) the "//" prefix for that, just like C and most of its variants. I did chose to use "//" in stead of "--" as I plan to make NIL support instructions like "i++" and "i--" and the latter would then be taken as an "i" with a comment, and not as an "i=i-1".
The current version of NIL does NOT support multi-line comments, nor are they planned on the short term.
// Hello World function
void Hello()
print("Hello World") // Put it on screen!
end
// End the function
That is the idea!
A few prototype notes:
- In "directives" (every line prefixed with a #) comments are not allowed
#macro this is not correct // No way.
The comment will just be part of the macro in that example, and with other directives more destructive things can happen.
- Declaration lines (no matter what is declarated) may NOT contain comments
int v = 10 // This comment will not work so well
// This comment won't have trouble.
int x = 20
- In class scopes comments comments must have lines for themselves only
class Comments
// No problem
int i = 10
void m() // A problem
print("ok") // This comment is fine, though, as this is just a regular command.
end // No go!
end
If these issues can be fixed in the future is not yet known, for the time being, AVOID doing this, as the translator will spook up, and so will Lua as a result.