The interpreter relies on semicolons to delimit statements and they will be added when needed by the interpreter. You might be thinking “Cool, that saves a lot of typing!” but let me explain you how it works internally.
The interpreter has no way to know where the statment ends, so it will happily execute it until it encounters an error due to a missing semicolon. When this happens it will insert a semicolon and try again.
As you can see executing code statements twice is not ver performant but you can encounter weirder bugs to to missing semicolon
consider this code
This code should convert a variable of unknown type to a string and lowercase it, instead it throws a syntax error this is because without the semicolon the code is evaluated as
Do you see the problem ?
Please always end your statements with a semicolon
For the same reasons as before the placement of the opening curly brace is also not optional.
The opening curly brace should be on the same line as the statement otherwise you will be giving extra work to the interpreter