# Using Environment Variables inside a conditional

**URL:** <https://discuss.circleci.com/t/using-environment-variables-inside-a-conditional/39152>\
**Category:** Build Environment\
**Created:** [February 16, 2021, 9:36am UTC](https://discuss.circleci.com/t/using-environment-variables-inside-a-conditional/39152 "2021-02-16T09:36:47Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![yannCI](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/yannci/32/24866_2.png) [@yannCI](https://discuss.circleci.com/u/yannCI)\
**Post date:** [April 23, 2021, 4:58pm UTC](https://discuss.circleci.com/t/using-environment-variables-inside-a-conditional/39152/4 "2021-04-23T16:58:29Z")

</div>

Hi @stevensim226,

This can be done using the [`env_var_name` parameter type](https://circleci.com/docs/2.0/reusing-config/#environment-variable-name).

You would need to declare a parameter in your job based on the environment variable:

```
parameters:
  condition_needed:
    default: CONDITION_ONE
    type: env_var_name

```

Then you’ll be able to use that parameter inside the `when` step:

```
- when:
    condition:
      equal: [true, "${<< parameters.condition_needed >>}"]

```

_(Edits: Environment variables always have the type `string`, so you’ll need to use the above syntax **+** syntax for `env_var_name` parameters interpolation)_

---

_[View the full topic](https://discuss.circleci.com/t/using-environment-variables-inside-a-conditional/39152)._
