I went to this error by chance which I fixed with some diverted way, but still I was curious how it is solved for Julia.
Suppose the MWE:
julia> a = 1 ; b = 5 ; some_logical_value = true julia> @assert a > 0 ? b in 1:10 : some_logical_value ERROR: syntax: space required before colon in "?" expression Stacktrace:  top-level scope at none:1
Which yields an error as, not surprisingly
: from ternary operator and
: from 1:10 is misleading for Julia. How should we do so?
You just need to add parentheses enclosing the range expression, so either of
@assert a > 0 ? b in (1:10) : some_logical_value
@assert a > 0 ? (b in 1:10) : some_logical_value
Answered By – Simeon Schaub
Answer Checked By – Willingham (AngularFixing Volunteer)