On Tuesday, 18 May 2021 at 16:27:13 UTC, Alain De Vos wrote:
After each } i write a ;
And let the compiler tell me it is an empty instruction.
What are the general rules where ; is not needed after a }

This is a good question, I'm not sure I can provide a concise answer.

In general you don't need a ; after }

The ; is used to end a statement, but I don't know how to define that and distinguish it from an expression.

The {} create a block of code, usually they will contain statements, so it would be common to see ; inside.

The only real time I would expect a }; is when you're defining a lambda/delegate and assigning to a variable.

auto Foo = X;

If X is something that ends with } we will still expect a ; to end the statement.

Reply via email to