# Global variables

**URL:** <https://community.postman.com/t/global-variables/27538>\
**Category:** Help Hub\
**Tags:** variables, globals\
**Created:** [September 7, 2021, 1:42am UTC](https://community.postman.com/t/global-variables/27538 "2021-09-07T01:42:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cmnazario](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/cmnazario/32/10207_2.png) [@cmnazario](https://community.postman.com/u/cmnazario)\
**Post date:** [September 7, 2021, 1:42am UTC](https://community.postman.com/t/global-variables/27538/1 "2021-09-07T01:42:37Z")

</div>

Hey guys,  
A question, what is the difference between:

`pm.globals.set("variable_key", "variable_value");`

and

`postman.setGlobalVariable('test', 'my_value')`

---

<div class="post-metadata">

**Author:** ![cmnazario](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/cmnazario/32/10207_2.png) [@cmnazario](https://community.postman.com/u/cmnazario)\
**Post date:** [September 9, 2021, 1:58pm UTC](https://community.postman.com/t/global-variables/27538/2 "2021-09-09T13:58:31Z")

</div>

It was clarified through the Postman community by Claire on Discord, this is the link that better explains the relationship between them in case anyone else has the same question 👇🏽

> <https://github.com/postmanlabs/postman-app-support/issues/3648>
>
> There are now \*\*two ways to work with variables\*\*, for example: \`postman.getEnvi…ronmentVariable("foo") \` and \`pm.environment.get("foo")\`. \*\*Same goes for \`tests\`\*\*, old style vs \`pm.test\`.
> 
> I have recently noticed that the snippets panel has changed and uses the pm version to work with variables / tests. 
> 
> I am a bit confused, because the documentation is out-of-sync with the actual product. Is the old style getting deprecated or something?
