Skip to content

Commit

Permalink
Corrects note about use of named blocks (#10521)
Browse files Browse the repository at this point in the history
Removes incorrect assertion that functions must use `begin`, `process`, and `end` if any named block is used. 

This implies these blocks are required even if they are empty. Assertion is contradicted later in the document when discussing `process`.
  • Loading branch information
indented-automation authored Oct 13, 2023
1 parent 7ae44e9 commit 1452ea4
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,12 @@ Function Test-ScriptCmdlet
}
```

> [!NOTE]
> Using either a `begin` or `end` block requires that you define all three
> blocks. When using any block, all PowerShell code must be inside one
> of the blocks.
PowerShell 7.3 adds a `clean` block process method.

> [!NOTE]
> Using any of the three named block above, or `dynamicparam` and `clean`,
> requires that all code in a function must reside in a named block.
### `begin`

This block is used to provide optional one-time preprocessing for the function.
Expand Down

0 comments on commit 1452ea4

Please sign in to comment.