IfCompiled[comp,uncomp]
gives comp when compiled and uncomp when evaluated.


IfCompiled
IfCompiled[comp,uncomp]
gives comp when compiled and uncomp when evaluated.
Details

- IfCompiled[comp,uncomp] ignores uncomp when compiling and ignores comp when evaluating.
- Compilation for IfCompiled is carried out by FunctionCompile and related functions.
- IfCompiled can be useful to migrate evaluated code to the compiler.
Examples
open all close allBasic Examples (1)
Define a function that uses IfCompiled:
During normal evaluation, this function returns the uncompiled result:
Compile the function. FunctionCompile compiles with the compiled branch of IfCompiled:
Scope (1)
Evaluation (1)
In evaluated mode, IfCompiled only processes the uncompiled argument:
In compiled mode, IfCompiled only processes the compiled argument:
See Also
Tech Notes
Related Guides
History
Text
Wolfram Research (2022), IfCompiled, Wolfram Language function, https://reference.wolfram.com/language/ref/IfCompiled.html.
CMS
Wolfram Language. 2022. "IfCompiled." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/IfCompiled.html.
APA
Wolfram Language. (2022). IfCompiled. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/IfCompiled.html
BibTeX
@misc{reference.wolfram_2025_ifcompiled, author="Wolfram Research", title="{IfCompiled}", year="2022", howpublished="\url{https://reference.wolfram.com/language/ref/IfCompiled.html}", note=[Accessed: 15-August-2025]}
BibLaTeX
@online{reference.wolfram_2025_ifcompiled, organization={Wolfram Research}, title={IfCompiled}, year={2022}, url={https://reference.wolfram.com/language/ref/IfCompiled.html}, note=[Accessed: 15-August-2025]}