The off variation
Read time: 2 minutes
Last edited: Jul 25, 2024
Overview
This topic explains how to set the off variation for a flag.
When the toggle is turned off, LaunchDarkly will serve the default off variation for your feature flag. For boolean flags, the default off variation is set to false
. For multivariate flags, you select one of your custom variations.
The off variation is different from the default rule, which is the rule that determines which variation a flag serves to contexts that don't match any of the flag's previous targeting rules. To learn more, read The default rule.
The off variation is also different from the fallback value, which is the value that contexts receive if your application can't connect to LaunchDarkly. To learn more, read Fallback value.
Set the off variation
You can customize the default off variation for both boolean and multivariate flags on each flag's targeting page, or in your flag templates. To learn more, read Flag templates.
If you do not specify a default off variation, then the SDK will return the fallback value defined in your code when the flag is off.
Regardless of how you set up targeting for your feature flag, each time you evaluate a flag from the SDK, you must include a fallback value as one of the parameters. This fallback value is the value served to the context if the SDK cannot connect to LaunchDarkly. To learn more, read Evaluating flags.