Compile::cret1
Details
-
- This message is generated when an expression to be compiled includes more than one point of return and not all of the points return an expression of the same type.
- The return type can be _Integer, _Real, _Complex, or True|False, or arrays of _Integer, _Real, _Complex.
- Off[message] switches off the message; On[message] switches it on. For example: Off[Compile::cret1].
Examples
Basic Examples (1)
One of the possible return types is an integer and the other possible return type is Boolean:
Compile[{x}, If[x > 0, Return[1], Return[False]]]The compilation succeeds if all of the possible return values have the same type:
Compile[{x}, If[x > 0, Return[True], Return[False]]]