Semicolons are used in action code to separate discrete actions, i.e. discrete whole tasks (as opposed to expressions). A desired outcome may use one such action or several.
$Color = "blue'; $Badge = "ok";
General practice is to place each action on a new line within the overall action code , so semicolons are most often seen as line-ends in code.
$Color = "blue';
$Badge = "ok";
The last action in code comprising multiple actions doesn't require a semicolon end but no harm comes from doing so.
$Color = "blue'; $Badge = "ok";
Thus for the novice a good rule of them is to always end lines of code with a semicolon.
An exception is code lines ending with an opening curly bracket—see why.
Failure to use a semicolon where needed will result in a silent failure of all or part of the action.