Julia introduced Compound expressions, which allows you to execute multipl expressions with a single value.
This can be acheived using begin
and end
keywords
variable = begin
expression1
expression2
expression3
end
We can replace the above expressions into a single expression using ;
symbol.
variable = begin expression1; expression2; expression3; end
Here is an example
result = begin first = 2; second = 13; first * second end
Above Simplified using below expression
(first = 1;
second = 2;
first * second)
Variable scope inside begin blocks.
The variables does not have any local scope until local variable is declared.