1
How the symbol works ;
on the moon?
;;;;
; ;
do ; end;
do ;end
do ;end;
do;end;
;do end
;do end;
;do ; end;
;;do ; end
do end
1
How the symbol works ;
on the moon?
;;;;
; ;
do ; end;
do ;end
do ;end;
do;end;
;do end
;do end;
;do ; end;
;;do ; end
do end
6
*Obs.: statement is not an expressive instruction.*
Basically semicolons (the symbols ;
) separate statements, but in version 5.2 there is a simple change.
Old-fashioned
Up to version 5.1, the semicolons separate statements, may appear only after the optional end of a statement. It is not necessarily semicolons that separate statements.
New operation
In version 5.2 semicolons generate, or in other words become Empty statements, statements that do nothing. It is nonspecific if Empty statements delimit statements, but they can be ignored (not "listed") by interpreters. No moon, for example, for (;;) ;
in Ecmascript, where the Empty statement would be the body of that native loop, then the Lua interpreter simply ignores the Empty statements (not "list" them), it is possible to see this in the language source code.
This is perfectly valid in version 5.2+:
; chamada();;;;
Here is an example of how the versions differ.
That is always true:
do end;
but
do
;
end
,
; do end
or
;;;;;;;;;;;;;; do ;;;;; end ;;;;;;
are incorrect in versions below 5.2, as one or more semicolons do not appear after a statement.
Browser other questions tagged lua
You are not signed in. Login or sign up in order to post.
I find the initiative to ask the answer too interesting. I am a master at doing this here. But I believe that, when you ask, both question and answer must be clear, so as not to give the impression that only you know how to answer what you asked. And editing the question will be a great opportunity for other users to put something else as an answer.
– Wallace Maxters
@Yeah, that’s what I’m doing. As I am doing this on mobile, my edits are being slow, I will still try to be clearer if possible.
– Klaider
@Wallacemaxters The answer was edited according to the new Dit in the question. Now I will find a way to clarify this on mobile.
– Klaider
Perfect! I was also using mobile today (a bag to edit/write)
– Wallace Maxters
@Wallacemaxters I think it gives p/ re-open the question
– Klaider