Code examples

Give change

Subtract the price from the amount paid to find the change.

Simple example

Start5 − 2
Result3
lesson.jl
function main()
    println((5 - 2))
end

main()
Output
3
Advertisements

Everyday examples

A customer pays 20 for a meal costing 13. How much change should they get?

Start20 − 13
Result7
lesson.jl
function main()
    paid = 20
    price = 13
    println((paid - price))
end

main()
Output
7
Run the example
Terminal
julia lesson.jl
Official documentation