feature_ifelse: Evaluates one or the other expression based on whether the...

Description Usage Arguments Details Value Examples

View source: R/helpers.R

Description

Evaluates one or the other expression based on whether the feature flag is enabled.

Usage

1
feature_ifelse(feature_flag, true_expr, false_expr)

Arguments

feature_flag

flag which defines which expression should be evaluated

true_expr

expression to evaluate when the feature_flag is enabled

false_expr

expression to evaluate when the feature_flag is disabled

Details

The passed expression is evaluated in the frame where feature_ifelse is called.

Value

The result of evaluating true_expr is returned if the passed feature_flag is enabled. Otherwise the result of evaluating false_expr is returned.

Examples

1
2
3
4
5
6
7
8
9
{
  flag <- create_bool_feature_flag(TRUE)

  feature_ifelse(
    flag,
    2 * 7,
    3 * 7
  )
}

featureflag documentation built on Feb. 18, 2021, 5:06 p.m.