You need to sign in or sign up before continuing.×
Ad
Fundamentals
Arrays
Code
Diff
  • function Sum-OfPositive($NumberArray)
    {
      [Func[int,bool]]$Delegate = {param($v); return $v -ge 0}
      [Linq.Enumerable]::Sum([Linq.Enumerable]::Where([int[]]$NumberArray,$Delegate))
    }
    
    • function Sum-OfPositive($NumberArray)
    • {
    • ($NumberArray | ?{$_ -gt 0} | Measure -sum).Sum
    • [Func[int,bool]]$Delegate = {param($v); return $v -ge 0}
    • [Linq.Enumerable]::Sum([Linq.Enumerable]::Where([int[]]$NumberArray,$Delegate))
    • }