Data types
Use whole numbers for things you count. Use a decimal when you need part of a unit.
Simple example
Divide five into two equal parts.
Start5 ÷ 2
Result2.5
function main()
value = 5.0
println(value / 2)
end
main()
2.5
Advertisements
Everyday examples
Two friends share a length of ribbon equally. How many metres does each friend get?
Start7 m ÷ 2
Result3.5
function main()
metres = 7.0
println(metres / 2)
end
main()
3.5