This topic explains how to manage flag targeting rules.
LaunchDarkly evaluates targeting rules after any flag prerequisites. You use flag prerequisites to make flags depend on other flags being enabled to take effect. To learn more, read Flag prerequisites.
Evaluation order determines which variation a context receives when multiple targeting rules or targets could apply. Flags evaluate flag prerequisites and rules from top to bottom.
This diagram represents rule matching behavior:

At each step in the process, if the context instance matches the rule, it receives the appropriate variation. If it does not match the rule, it moves on to the next rule.
Configure your SDK: Evaluating flags
Here is how a context instance moves through a flag evaluation:
true is always 0 and the index of false is always 1. This means that if a multi-context is individually targeted multiple times with different variations, the multi-context will always receive true.red first, it will have an index of 0, and if you create the variation blue second, it will have an index of 1.Here is an image of two targeting rules:

In this example, the first rule (if the segment is not in Beta users) is evaluated before the second rule (if the organization key is Beta).
You can reorder mobile targeting, segment targeting, and custom rules by clicking and dragging them into different positions. Alternatively, you can click the overflow menu of the flag targeting rule you want to move. Then, select Move rule up or Move rule down.
You cannot reorder prerequisites or individual targets. Only mobile targeting, segment targeting, and custom rules can be reordered.
You can create new targeting rules by duplicating a flag’s existing targeting rule and modifying the new rule.
To duplicate an existing targeting rule:
Here is an image of the “Duplicate rule” option in the rule menu:

The new rule appears below the original rule. You must make at least one change to either the existing rule or the new rule before saving your changes, to prevent two exact duplicate rules on the same flag.
You can disable a targeting rule without deleting it. This lets you maintain the rule for later use. LaunchDarkly skips disabled rules during flag evaluation.
To disable a targeting rule:
The rule is now disabled. To re-enable the rule, click the three-dot overflow menu and select Enable rule.