2 ms·
The common workaround is to pass in a dictionary that's then used for return values. Workable, but seriously? Is that the best they could do?
by maxxxxx 8y ago
The common workaround is to pass in a dictionary that's then used for return values. Workable, but seriously? Is that the best they could do?
- reificator 8y agoThat is... not the way I generally work around it or see it. Normally you just use Write-Host when you need it and otherwise just collect return values inside the function by assigning them to variables. It's basically solved if you never call a command without storing the return value somewhere. Which is not optimal in a scripting language where you just want to get things done, but it's not the end of the world.
- jodrellblank 8y agoDo you have any examples? This doesn't sound familiar. Dictionaries are often used for return values, as they can be cast to PSCustomObject for a quick way to make objects for the pipeline. But in that use case they aren't passed in, and that's not anything to do with the `return` keyword or all output from all commands becoming function output.