Skip to content

Instantly share code, notes, and snippets.

@goyalmohit
Created June 26, 2019 06:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goyalmohit/0b7c16eb39199873728a9f776fc8b1b9 to your computer and use it in GitHub Desktop.
Save goyalmohit/0b7c16eb39199873728a9f776fc8b1b9 to your computer and use it in GitHub Desktop.
Function Get-PersonDetails {
Begin {
Write-Verbose "In Begin Block: Get-PersonDetails"
$PersonName = @()
$PersonAge = @()
}
Process{
Write-Verbose "In Process Block: Get-PersonDetails"
$PersonName = "Keith", "Eddy", "Kevin", "Kate"
$PersonAge = 29, 34, 23, 15
}
End{
Write-Verbose "In End Block: Get-PersonDetails"
return $PersonName, $PersonAge
}
}
$PersonName = @()
$PersonAge = @()
$PersonName, $PersonAge = Get-PersonDetails
foreach($item in 0..3){
Write-Host "$($PersonName[$item]) is $($PersonAge[$item]) years old"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment