I have some PowerShell scripts with a load of initialization steps, at the end of which I put a
statement, intending to catch all unhandled errors from that point onwards
Unexpectedly I realized that when I goofed in my initialization logic the
was being called even though the error happened before the
A simple example:
Write-Out "World" # Incorrect cmdlet name causes an error
Clearly it seems that it doesn't matter that the
is defined after the buggy line of code, but can someone explain why this works anyway?