Julia control flow
Julia has a complete set of control flows. As an example, we could have a small function larger that determines the larger of two numbers:
function larger(x, y)
if (x>y)
return x
end
return y
end
println(larger(7,8)) There are several features that you must note:
- The
endstatement for theifstatement end, as the closing of the function- The indentation of the statements within the function
- The indentation of the handling of a true condition within an
ifstatement
If we run this under Jupyter, we would see the expected output, as shown in the following screenshot:
