-
Notifications
You must be signed in to change notification settings - Fork 1
Home
zzorn edited this page Sep 14, 2010
·
8 revisions
ScalaQuantity type checks expressions using physical units on compile time for unit assignment correctness.
Usage example of ScalaQuantity:
import scalaquantity.Units._
object VelociraptorTest {
def main(args: Array[String]) {
val velociraptorSpeed = 25 * m / s
val humanRunningSpeed = 10 * km / h
val distance = 30 * feet
val humanRemainingLifeTime: Time = distance / (velociraptorSpeed - humanRunningSpeed)
println("Seconds left to live: " + humanRemainingLifeTime)
}
}