Task

Write a procedure which accepts as arguments another procedure and a positive integer.

The latter procedure is executed a number of times equal to the accepted integer.




 
function Out-Example
{
    "Example"
}
 
function Step-Function ([string]$Function, [int]$Repeat)
{
    for ($i = 1; $i -le $Repeat; $i++)
    { 
        "$(Invoke-Expression -Command $Function) $i"
    }
}
 
Step-Function Out-Example -Repeat 3
 