[R] return inconsistency?

Ivan Krylov
2025-04-30T13:27:45Z

On Wed, 30 Apr 2025 11:15:02 +0200
Ralf Goertz via R-help <r-help at r-project.org> wrote:

> If this is not an error what is its purpose?

From the point of view of the R syntax, everything is an expression.

One of the uses of return() being an expression is base::callCC(). The
ability to use it inside an expression makes it possible to put it into
a delayed-evaluation object and offer it as a continuation point to
another function.

Admittedly obscure, but sometimes useful.

--
Best regards,
Ivan