Skip to content

Commit 1452ea4

Browse files
Corrects note about use of named blocks (#10521)
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`.
1 parent 7ae44e9 commit 1452ea4

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

reference/7.3/Microsoft.PowerShell.Core/About/about_Functions_Advanced_Methods.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,12 @@ Function Test-ScriptCmdlet
6161
}
6262
```
6363

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

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

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

0 commit comments

Comments
 (0)