The off variation
Read time: 2 minutes
Last edited: Oct 03, 2024
Overview
This topic explains how to set the off variation for a flag.
When the toggle is turned off, LaunchDarkly serves the default off variation for your feature flag. For boolean flags, the default off variation is set to false
, but you can change this if you like. For multivariate flags, you select one of your custom variations.
The off variation is different from the default rule. The default rule determines which variation a flag serves, when toggled on, 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. The fallback value 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.