Skip to contents

Equivalents to cli::qty() and cli::no() for a logical input.

Usage

cli_qty_lgl(cnd)

cli_no_lgl(cnd)

Arguments

cnd

Condition. A logical scalar.

Value

0L or 1L with the additional class cli_noprint.

Details

If cnd evaluates to TRUE, the resulting cli quantity is 1, otherwise 0. See cli's pluralization rules for details about how these quantities are interpreted.

See also

Other functions extending the cli package: cli_process_expr(), cli_progress_step_quick()

Examples

cnd <- runif(1L) < 0.5

cli::pluralize(paste0(
  "{pal::cli_qty_lgl(cnd)}I think this function ",
  "{?comes in handy/is not worth a second of my attention}. Having looked at the rest of the ",
  "package, this {?is quite surprising/does not come as a surprise}."
))
#> I think this function is not worth a second of my attention. Having looked at the rest of the package, this does not come as a surprise.

cli::pluralize("This function is worth exactly {pal::cli_no_lgl(cnd)} second of my time.")
#> This function is worth exactly no second of my time.