> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/feature-flags/use-feature-flags/use-ff/ff-creating-flag/add-prerequisites-to-feature-flag.md).

# Add a Prerequisite to a Flag

This topic describes how to use feature flag prerequisites to enable or disable features based on different flag states.

A Prerequisite is a Feature Flag that you add as a dependency to another Feature Flag. That dependency must be met before that second Feature Flag can be toggled `ON` or `OFF`. For example, if you have a flag that allows users to write Java, the user must be able to read the Java first. Therefore, you add a Prerequisite to the `Write_Java` flag that says the `Read_Java` flag must be enabled before the `Write_Java` flag can be toggled on.

{% hint style="info" %}
At present, Harness currently *does not* support nested prerequities as this functionality is not currently supported.
{% endhint %}

#### Add a Prerequisite <a href="#add-a-prerequisite" id="add-a-prerequisite"></a>

1. Go to the Feature Flag you want to add the Prerequisite to.
2. Select **+ New Prerequisite**.

   ![A screenshot of the Write\_Java Flag with the Prerequisites button highlighted.](https://3868793495-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8hMqy7cgSxMJvSqtZuUT%2Fuploads%2Fgit-blob-a1382ea95ed554e86ea1781c6556a493d8dcf4a9%2F3-add-prerequisites-to-feature-flag-02.png?alt=media)
3. In **Add Prerequisites**, click **+ Prerequisites**.
4. In the first drop-down menu, select the flag you want to use as a Prerequisite.
5. In the second drop-down, select which Variation of the Prerequisite flag must be served before the Feature Flag can be turned on.

   For the example below, the `Read_Java` flag must be set to `True` before this flag can be enabled.
6. Select **Save**. The Prerequisite flag is listed on the Feature Flag page and must be met before you can turn on the Feature Flag.

   !["A screenshot of the Prerequisite flag added to the Write\_Java flag.](https://3868793495-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8hMqy7cgSxMJvSqtZuUT%2Fuploads%2Fgit-blob-c75c9abeb2f9259d5c0a912939d3ba34953a6b70%2F3-add-prerequisites-to-feature-flag-03.png?alt=media)

{% @harness-feedback/feedback %}
