I want to conditionally load some functions with a guardian statement to avoid nesting.
But I found that return keyword does not work as I assumed.
# this file is expected to be sourced by module.psm1
if ($condition) {
return # return does not terminate the loading here
}
# functions would be loaded no matter what $condition is presented
function foo {}
function bar {}
wrapping functions inside if did work but I just want a guardian if it’s available