Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

done

Box a final value for early termination


Description

A value boxed with done() signals to its caller that it should stop iterating. Use it to shortcircuit a loop.

Usage

done(x)

is_done_box(x, empty = NULL)

Arguments

x

For done(), a value to box. For is_done_box(), a value to test.

empty

Whether the box is empty. If NULL, is_done_box() returns TRUE for all done boxes. If TRUE, it returns TRUE only for empty boxes. Otherwise it returns TRUE only for non-empty boxes.

Value

A boxed value.

Examples

done(3)

x <- done(3)
is_done_box(x)

rlang

Functions for Base Types and Core R and 'Tidyverse' Features

v0.4.11
MIT + file LICENSE
Authors
Lionel Henry [aut, cre], Hadley Wickham [aut], mikefc [cph] (Hash implementation based on Mike's xxhashlite), Yann Collet [cph] (Author of the embedded xxHash library), RStudio [cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.