When you leave data behind, PowerShell automatically returns it to the caller. This may create strange-looking code. With Write-Output, you can explicitly assign your return values. These two examples work the same:
Function testA {
'My Result'
}
Function testB {
Write-Output 'My Result'
}
'My Result'
}
Function testB {
Write-Output 'My Result'
}