fork/numbat

git clone https://git.julia.blue/fork/numbat

David PeterAdd examples to the documentatione157883

v1.6.3
433 B14 linesraw
1# This script calculates and prints the molarity of a salt
2# water solution, given a fixed mass of salt (NaCl) and a
3# volume of water.
4
5let molar_mass_NaCl = 58.44 g / mol
6
7fn molarity(mass: Mass, volume: Volume) -> Molarity =
8    (mass / molar_mass_NaCl) / volume
9
10let salt_mass = 9 g
11let water_volume = 1 L
12
13print(molarity(salt_mass, water_volume) -> mmol / l)
14assert_eq(molarity(salt_mass, water_volume), 154 mmol/l, 0.1 mmol/l)