This project is read-only.
Define units of measure

Units of Measure
Description: Define and use measure unit. The units of measure is a compile time feature, so it won't go into the binary file.
[<Measure>]type litre
[<Measure>]type pint

let MeasureSample1() =
let v1 = 2.
let v2 = 1.
let ratio = 1.0 / 1.76056338
let pintToLitre pints =
pints * ratio
let newVol = v1 + (pintToLitre v2)
printfn "converted value is %A" newVol

Execution Result:
converted value is 2.568

Last edited Sep 14, 2011 at 4:15 AM by ttliu2000, version 1


No comments yet.