# encoding: ascii
# api: powershell
# title: Get-Scope
# description: Get PowerShell numbered scope in anytime!!!
# version: 0.1
# type: function
# author: ingted
# license: CC0
# function: Get-Scope
# x-poshcode-id: 2642
# x-archived: 2011-05-03T14:16:45
# x-published: 2011-05-01T00:57:00
#
#
function Get-Scope{
    $rtnScope = 0
    $global:scope = $false
    $scope = $true
    while($($ErrorActionPreference = "silentlycontinue"; switch((get-Variable -Name scope -Scope $rtnScope).value){$null{$true} $true{$true} $false{$ErrorActionPreference = "continue"; return ($rtnScope - 1)}})){
        $rtnScope++
    }
}

<#Example.

function gg{
    Get-Scope
}; 

function iii{
    gg
}; 

iii    ==> result is 2#>
