In the specific case where I want the ternary operator to give me an operator, it fails, but the if then else approach works. I expect there is an explanation, or maybe it is a bug.
What does not work
julia> a = "1+2";
julia> op = contains(a, '+') ? + : -
ERROR: syntax: whitespace not allowed after ":" used for quoting
Stacktrace:
[1] top-level scope
@ none:1
and what does work
julia> a = "1+2";
julia> if contains(a, '+')
op = +
else
op = -
end
+ (generic function with 206 methods)
julia> op(4,5)
9