Julia Programming Language
Best way for comparisons in one line to avoid undesired effects of operator precedence
New to Julia
mcabbott
November 11, 2020, 9:56am
2
Two ways:
julia> if 7+2<10; -3 else 0 end -3 julia> 7+2<10 ? -3 : 0 -3
8 Likes
show post in topic
Related topics
Topic
Replies
Views
Activity
Style question: ternary operator or short circuit operator or if-end
General Usage
17
1417
February 6, 2020
One-line if-else statement with short-circuit evaluation
General Usage
1
372
August 6, 2022
Strange behaviour with if-else-Statements
Optimization (Mathematical)
jump
,
bug
4
1101
September 25, 2020
One-line `if ... then ...` syntax
Internals & Design
syntax
26
5838
April 22, 2022
Problem with ternary operator
New to Julia
2
606
March 13, 2017