IncrementalReceive[default]
pauses the enclosing incremental function and on resumption returns the value from "Send" or default.


IncrementalReceive
IncrementalReceive[default]
pauses the enclosing incremental function and on resumption returns the value from "Send" or default.
Details

- IncrementalYield can only be used in Function expressions marked with IncrementalFunction.
- Functions in which IncrementalReceive appears have to be processed by compiler functions such as FunctionCompile.
- After executing IncrementalReceive, the incremental function will save its local variables and return to the caller.
- When an incremental function paused by a call to IncrementalReceive is resumed with a call to "Send", the result of the execution is the value.
- When an incremental function paused by a call to IncrementalReceive is resumed with a call to "Next", the result of the execution is the default value.
- When an incremental function is created, it pauses before any code is executed and has to be started with a call to "Next".
Examples
open all close allBasic Examples (2)
An incremental function that has one receive:
Create an instance of the incremental function:
Run the incremental function until it reaches the first IncrementalReceive:
A value can be sent to the incremental function with "Send":
The incremental function has finished, so nothing more can be sent to it:
An incremental function that can work to output a message:
Create an instance of the function and run it until it reaches the first IncrementalReceive:
Send an expression to the function, and it gets printed:
Compound expressions can be sent:
If "Next" is called, then the default value of the IncrementalReceive is returned:
Scope (1)
This incremental function prints a string before it reaches IncrementalReceive:
This creates an instance of the incremental function; the function is paused before any code has been executed:
The incremental function starts to run when "Next" is called; it will pause when it reaches IncrementalReceive:
When a value is sent to the incremental function with "Send", this causes it to resume:
See Also
IncrementalFunction Function Typed FunctionCompile FunctionDeclaration IncrementalYield
Compiled Types: IncrementalFunction
Tech Notes
Related Guides
History
Text
Wolfram Research (2025), IncrementalReceive, Wolfram Language function, https://reference.wolfram.com/language/ref/IncrementalReceive.html.
CMS
Wolfram Language. 2025. "IncrementalReceive." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/IncrementalReceive.html.
APA
Wolfram Language. (2025). IncrementalReceive. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/IncrementalReceive.html
BibTeX
@misc{reference.wolfram_2025_incrementalreceive, author="Wolfram Research", title="{IncrementalReceive}", year="2025", howpublished="\url{https://reference.wolfram.com/language/ref/IncrementalReceive.html}", note=[Accessed: 04-August-2025]}
BibLaTeX
@online{reference.wolfram_2025_incrementalreceive, organization={Wolfram Research}, title={IncrementalReceive}, year={2025}, url={https://reference.wolfram.com/language/ref/IncrementalReceive.html}, note=[Accessed: 04-August-2025]}