Skip to content

Monetary Type

The monetary type stores a numeric amount with its currency, preventing accidental mixing of different currencies.

Diagram

          

Add or subtract values with the same currency:


          

Attempting to add different currencies raises an error:


          

Get the currency for a country:


          

Get countries using a currency:


          

The parser handles various formats:


          

Ambiguous symbols like $ require explicit currency codes: