4 ms·
There are two aspects to this, the trigraph, and using the short circuiting behaviour of the binary logic operator for control flow. The latter is a very commo
by FabHK 4y ago
There are two aspects to this, the trigraph, and using the short circuiting behaviour of the binary logic operator for control flow.
The latter is a very common idiom in Julia code, which I found obscure and puerile at first (“look how smart I am”), but have come to appreciate as concise and natural by now.
For example:
function fact(n::Int)
n >= 0 || error("n must be non-negative")
n == 0 && return 1
n * fact(n-1)
end
https://docs.julialang.org/en/v1/manual/control-flow/#Short-Circuit-Evaluation https://docs.julialang.org/en/v1/manual/control-flow/#Short-...