Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Julia: function inside a function


In Julia, you can define a Function inside another function.

julia> function arithmetic(a, b)
function sum(a ,b)
a+b
end

function subtract(a, b)
a-b
end

function mul(a, b)
a*b
end

function div(a, b)
a/b
end

r1 = sum(a, b), subtract(a, b), mul(a,b), div(a,b)
end
arithmetic (generic function with 1 method)

julia> addition, subtraction, multiplication, division = arithmetic(20, 10)
(30,10,200,2.0)

julia> addition
30

julia> subtraction
10

julia> multiplication
200

julia> division
2.0



Previous                                                 Next                                                 Home


This post first appeared on Java Tutorial : Blog To Learn Java Programming, please read the originial post: here

Share the post

Julia: function inside a function

×

Subscribe to Java Tutorial : Blog To Learn Java Programming

Get updates delivered right to your inbox!

Thank you for your subscription

×