Last active
November 28, 2021 18:15
-
-
Save goyalmohit/5f324c934330cbb40aa60d5b2f314667 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function Get-Sum { | |
[CmdletBinding()] | |
Param( | |
[Parameter(Mandatory=$true)] | |
[ValidateNotNullOrEmpty()] | |
[int] $Number1, | |
[Parameter(Mandatory=$true)] | |
[ValidateNotNullOrEmpty()] | |
[int] $Number2 | |
) | |
Begin { | |
Write-Verbose "In Begin Block: Get-Sum" | |
$Sum = 0 | |
} | |
Process{ | |
Write-Verbose "In Process Block: Get-Sum" | |
$Sum = $Number1 + $Number2 | |
} | |
End{ | |
Write-Verbose "In End Block: Get-Sum" | |
return $Sum | |
} | |
} | |
$Sum = 0 | |
$Sum = Get-Sum -Number1 5 -Number2 7 | |
Write-Host $Sum |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment