Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [<Measure>] type kg //define a unit of measure
- let myMass = 80.0<kg> //define a mass in kg
- [<Measure>] type m //define a unit of measure
- [<Measure>] type s //define a unit of measure
- let g = 9.8<m/s^2> //define gravitational acceleration (with units)
- let myWeight = myMass * g // result is 784.0<kg m/s ^ 2>
- //ERROR: The unit of measure 'm' does not match the unit of measure 'kg m/s ^ 2'
- let stupidError = myWeight + myMass
Add Comment
Please, Sign In to add comment