条件評価

2026年3月14日
1 分

条件分岐とも。

Julia では ifelseifelse を使う。

julia> x = 3; y = 2
2

julia> if x < y
         println("x is less than y.")
       elseif x > y
         println("x is greater than y.")
       else
         println("x is equal to y.")
       end
x is greater than y.

三項演算子 ?: も使える。

julia> x = 100
100

julia> x > 100 ? true : false
false