$Var = 10
Class Scoping {
    [Int] Show () {
        return $var
    }
    Static [Int] ShowStatic () {
        return $Var
    }
} 

[Scoping]::ShowStatic()

#####Scoping Global#####

$Var = 10
Class ScopingGlobal {
    [Int] Show () {
        return $global:var
    }
    Static [Int] ShowStatic () {
        return $global:Var
    }
} 

[ScopingGlobal]::ShowStatic() # 10
$Sco = [ScopingGlobal]::New()
$Sco.Show() # 10

#####Scoping Script#####
##normal##
$Var = 10
$Script = @"
    `$Var = 20
    &{
        `$Var = 30
        Class ScopingScript {
            [Int] Show () {
                return `$script:var
            }
            Static [Int] ShowStatic () {
                return `$script:Var
            }
        }
        [ScopingScript]::ShowStatic()
    }
"@
$Script > ./scriptscope.ps1
. ./scriptscope.ps1
##fonction##
$Var = 10
$Script = @"
    `$Var = 20
    &{
        `$Var = 30
        Function FCTScope {
            `$Var = 
            Class ScopingScript {
                [Int] Show () {
                    return `$script:var
                }
                Static [Int] ShowStatic () {
                    return `$script:Var
                }
            }
            Return [ScopingScript]::ShowStatic()
        }
        FCTScope
    }
"@
$Script > ./scriptscope.ps1
. ./scriptscope.ps1

#####Scoping Locale#####
$Var = 10
Class Scoping2 {
    [Int] Show () {
        return $(Get-Variable -Name Var -Scope 1)
    }
    Static [Int] ShowStatic () {
        return $(Get-Variable -Name Var -Scope 1)
    }
} 

[Scoping2]::ShowStatic()