Created
June 26, 2019 06:46
-
-
Save goyalmohit/c52228f9ed8f22386e81f8e8a67045e0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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-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" | |
$PersonName | |
$PersonAge | |
} | |
} | |
$PersonName = @() | |
$PersonAge = @() | |
$returnedData = Get-PersonDetails | |
$PersonName = $returnedData[0], $returnedData[1], $returnedData[2], $returnedData[3] | |
$PersonAge = $returnedData[4], $returnedData[5], $returnedData[6], $returnedData[7] | |
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