---
title: "getGlobalVarExists"
canonical: "https://help.vicon.com/space/Shogun112/31230333/getGlobalVarExists"
format: markdown
---
# Description

Queries whether a specified global variable exists in the Shogun Post session or not.

Shogun Post's scripting language supports global variables that are accessible across scripts within a session of Shogun Post. This command checks the current session of Shogun Post to determine if a global variable exists and has been set or not.

## Functional area

System

# Command syntax

## Syntax

|  |
| --- |
| `getGlobalVarExists name` |

### Arguments

| **Name** | **Type** | **Required** | **Comments** |
| --- | --- | --- | --- |
| `name` | string | yes | Name of the variable to query |

### Flags

None

## Return value

boolean

Returns whether the global variable exists or not (true if the variable exists, false otherwise). 

> Macro (scroll-pagebreak)

## Examples

```plaintext
// Script A
// Define a global variable
setGlobalVar myVar "ShogunPost 1.11";
 
// Script B
// Check to make sure global variable set in Script A still exists
if( `getGlobalVarExists myVar` )
{
   // Use it
   string $progName = `getGlobalStringVar myVar`; 
   print($progName);
}
```

# Additional information

## Related commands

- [delGlobalVar](https://vicon-help.atlassian.net/wiki/spaces/Shogun112/pages/31232070)
- [getGlobalBooleanVar](https://vicon-help.atlassian.net/wiki/spaces/Shogun112/pages/31235796)
- [getGlobalIntVar](https://vicon-help.atlassian.net/wiki/spaces/Shogun112/pages/31233981)
- [getGlobalStringVar](https://vicon-help.atlassian.net/wiki/spaces/Shogun112/pages/31239122)
- [getGlobalVectorVar](https://vicon-help.atlassian.net/wiki/spaces/Shogun112/pages/31232351)
- [setGlobalVar](https://vicon-help.atlassian.net/wiki/spaces/Shogun112/pages/31230810)