xxxxxxxxxx
function GetRandomNumber {
$random = Get-Random -Minimum 1 -Maximum 100
return $random
}
# Calling the function and storing the returned value in a variable
$result = GetRandomNumber
# Printing the returned value
Write-Host "Random Number: $result"
xxxxxxxxxx
function Add-Numbers{
param(
[int]$a = 6,
[int]$b= 10
)
return $a + $b # note this return part
}
$store = Add-Numbers -a 10 -b 20
Write-Output $store