How does the ;
symbol on the moon work?
;;;;
; ;
do ; end;
do ;end
do ;end;
do;end;
;do end
;do end;
;do ; end;
;;do ; end
do end
How does the ;
symbol on the moon work?
;;;;
; ;
do ; end;
do ;end
do ;end;
do;end;
;do end
;do end;
;do ; end;
;;do ; end
do end
* Note: statement is a non-expressive statement. *
Basically semicolons (the ;
symbols) separate statements, but in version 5.2 there is a simple change.
Old operating
Until version 5.1, the semicolons separate statements , which may appear only after the optional statement. Not necessarily that semicolons separate statements.
New operation
In version 5.2, semicolons generate, or in other words, become empty in> statements, statements that do nothing. It is non-specific if empty statements delimit statements, but they can be ignored (not "listed") by interpreters. In the Lua there is no such thing as for (;;) ;
in ECMAScript, where the empty statement would be the body of this native loop, so the Lua interpreter simply ignores the empty statements (not "list" them), you can see this in the source code of the language.
This is perfectly true in version 5.2 +:
; chamada();;;;
Here's an example of how the versions differ.
This is always valid:
do end;
but
do
;
end
,
; do end
or
;;;;;;;;;;;;;; do ;;;;; end ;;;;;;
are incorrect in the versions below 5.2, because one or more semicolons do not appear after a statement.