From 01fad8f56a87ced756df9ec0a562dbdfce933521 Mon Sep 17 00:00:00 2001 From: Chris Dent Date: Fri, 13 Oct 2023 10:42:22 +0100 Subject: [PATCH] Corrects note about use of named blocks 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`. --- .../About/about_Functions_Advanced_Methods.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/reference/7.3/Microsoft.PowerShell.Core/About/about_Functions_Advanced_Methods.md b/reference/7.3/Microsoft.PowerShell.Core/About/about_Functions_Advanced_Methods.md index b8beba557e04..340043fd4ceb 100644 --- a/reference/7.3/Microsoft.PowerShell.Core/About/about_Functions_Advanced_Methods.md +++ b/reference/7.3/Microsoft.PowerShell.Core/About/about_Functions_Advanced_Methods.md @@ -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.