title: How should I output my result of sorting in console for each sort steps and could be controlled by Verbose parameter
body: <p>My bubble sort algorithm in Powershell.  I will be appreciated if you help me to output in console for each sort steps and could be controlled by Verbose parameter. Thank you in advanced;):</p>
  <pre><code>  function bubble_sort($a){
       $n=$a.Length
       for($i=1; $i -le ($n-1); $i+=1)
       {
           for($j=0; $j -le ($n-$i-1); $j+=1)
           {
               if($a[$j] -le $a[$j+1])
               {
                   $temp=$a[$j]
                   $a[$j]=$a[$j+1]
                   $a[$j+1]=$temp
               }
           }
       }
       return $a
       }
       
       $a=@()
       $a=@(10,50,40,20,70,60,30)
       $sorted=bubble_sort $a
       Write-Host Sorted Array:
       foreach($s in $sorted){
       $s
       }
  </code></pre>