Posts

Showing posts with the label syntax

Julia ternary operator without `else`

4 Consider the ternary operator in Julia julia> x = 1 ; y = 2 julia> println(x < y ? "less than" : "not less than") less than Question: Is there a way to omit the : part of the statement ? Something which would be equivalent to if condition # dosomething end without writing that if the condition is not met, nothing should be done. NB: I researched the answer but nothing came out, even in related questions (1, 2) if-statement syntax conditional-statements julia conditional-operator Share ...