સોર્સ ફાઇલો ગોઠવવી
કિંમતની ગણતરી તેની પોતાની ફાઇલમાં મૂકો. મુખ્ય કાર્યક્રમ તે કાર્યને કહે છે. ઉદાહરણ ચલાવતા પહેલા બંને ફાઇલોને એક જ ફોલ્ડરમાં સાચવો.
એક સરળ ઉદાહરણ
ફંક્શનને બીજી ફાઇલમાં કૉલ કરો.
શરૂઆતમાં2 × 3
પરિણામ6
module Prices
export total
total(units, price) = units * price
end
include("prices.jl")
using .Prices
function main()
println(total(2, 3))
end
main()
6
જાહેરાતો
રોજિંદા જીવનનાં ઉદાહરણો
એક નાસ્તાની દુકાન બે-બે સિક્કા પર પાંચ જ્યુસ વેચે છે. બાકી રકમ છાપવા માટે વહેંચાયેલ કિંમત કાર્યનો ઉપયોગ કરો.
શરૂઆતમાં5 juices × 2
પરિણામ10
module Prices
export total
total(units, price) = units * price
end
include("prices.jl")
using .Prices
function main()
println(total(5, 2))
end
main()
10