xxxxxxxxxx
Use pm.globals to define a global variable:
pm.globals.set("variable_key", "variable_value");
xxxxxxxxxx
function foo() {
var variable1, variable2;
variable1 = 5;
varaible2 = 6;
return variable1 + variable2;
}
xxxxxxxxxx
$GLOBALS['a'] = 'localhost';
function body(){
echo $GLOBALS['a'];
}
xxxxxxxxxx
$global:myAge =25;
function calculateAge
{
$MyAge =35;
Write-Host $MyAge "inside the function";
}
Write-Host $MyAge "outside the function";
calculateAge;