Scripting syntax
We will now dive into the specifics of the PowerShell syntax.
Statement terminators
A semicolon is typically a mandatory statement terminator in many programming and scripting languages. PowerShell considers both a newline and semicolon as statement terminators, although using the newline is more common. The caveat for using the newline is that the previous line must be a complete statement before it gets executed.
Escape and line continuation
The backtick (`
) is a peculiar character in PowerShell, and it has a double meaning. You can typically find this character on your keyboard above the left Tab key, and it is on the same key as the tilde ~
symbol.
The backtick is the escape character in PowerShell. Some of the common characters that need to be escaped are as follows:
Escaped character |
Description |
---|---|
|
Newline |
|
Carriage return |
|
Single quote |
|
Double quote |
|
Null |
PowerShell also uses the backtick (`
) as a line continuation character.