↧
Answer by Nathan Boyer for Julia ternary operator without `else`
&& is commonly used for this because it is short, but you have to know the trick to read it. I sometimes find it more readable to just use a regular old if statement. In Julia, it need not be...
View ArticleAnswer by Przemyslaw Szufel for Julia ternary operator without `else`
Just do:condition && do_somethingFor an example:2 < 3 && println("hello!")Explanation:&& is a short-circut operator in Julia. Hence, the second value will be only evaluated...
View ArticleJulia ternary operator without `else`
Consider the ternary operator in Juliajulia> x = 1 ; y = 2julia> println(x < y ? "less than" : "not less than")less thanQuestion: Is there a way to omit the : part of the statement ? Something...
View Article