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
end
statement for theif
statement 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
if
statement
If we run this under Jupyter, we would see the expected output, as shown in the following screenshot:
