News for hackers. Stuff that matters.
Re:Kotlin Money by eriksencosta on Tuesday October 08, 2024 @02:27PM (#41780290)
Joda is impressive and has great performance.

The examples were written using the infix notation but you can just use regular method calls. For example:

val price = Money.of(100, "USD")

val shipping = Money.of(5, "USD")

val subtotal = price.plus(shipping)

val discount = Percentage.of(10)

val total = subtotal.decreaseBy(discount)

total.allocate(2)

total.allocate(60.percent(), 40.percent())

There are no comments on this comment yet.