Learn R Programming

rlang (version 1.1.0)

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)

Value

A boxed value.

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.

Examples

Run this code
done(3)

x <- done(3)
is_done_box(x)

Run the code above in your browser using DataLab