note05
if x > y
println("x is greater than y.")
elseif x == y
println("x is equal to y.")
else
println("x is less than y.")
end
◆ Multiple conditions(&&, ||)
if x > 0 && y > 0
println("x and y is greater than 0.")
elseif x == 0 || y == 0
println("x or y is 0.")
end
◆ Ternary operator
if x > 0 ? true : false
-The major difference from Python is that there is ** end **. You need to start with if and end with end. ・ Else if and else are not required. You can add it if necessary. -The ** ternary operator ** is an operator in the form of "a? B: c" that returns b if the evaluation result of a is true and c if it is false.
Julia Quick Look Note [01] How to use variables and constants Julia Quick Look Note [02] Arithmetic Expressions, Operators [Julia Quick Note [03] Complex Numbers] (https://qiita.com/ttabata/items/225c77a4d71fafc3e482) Julia Quick Look Note [04] Regular Expression [Julia quick note [05] if statement] (https://qiita.com/ttabata/items/4f0bcff1e32f60402dfb)
(* We will continue to increase the content)
: paperclip: Julia --Official page https://julialang.org/
: paperclip: Julia --Japanese official document https://julia-doc-ja.readthedocs.io/ja/latest/index.html
: paperclip: First time Julia and installation (Windows & Linux) https://qiita.com/ttlabo/items/b05bb43d06239f968035
:paperclip: Julia - Mathematics https://docs.julialang.org/en/v1/base/math/
If you have any opinions or corrections, please let us know.
Recommended Posts