Currency is now a value type: never Nothing, defaults to zero, and accepts exact literal values
- Status
- Fixed
- Fixed in
- v26.8.1
- Source discussion
- https://forum.objo.dev/d/745-allow-properties-defined-as-currency-to-be-automatically-initialized
- Last updated
- 2026-08-04
Upvotes
0 upvotes
Uses your Objo forum account.
Public summary
Currency is now a true value type. A Currency property, variable, or other value that has not been explicitly assigned defaults to Currency.Zero instead of Nothing, so reading it can no longer crash with a "Nothing" error. Currency can never be Nothing: assigning or comparing it with Nothing is a compile-time error, and it now has raw-value equality, hashing, and copy semantics like Integer and Double.
You can also assign exact numeric literals directly to Currency (for example Property Balance As Currency = 12.34, Var c As Currency = 5, or a negative amount), as long as the value is exactly representable at 4 decimal places and within range; inexact literals produce a clear compile-time diagnostic instead of silently rounding, and New Currency(...) / Currency.FromDouble(...) remain the explicit rounding paths. All existing Currency arithmetic, parsing, formatting, and comparison behaviour is preserved, and New Currency(), New Currency(number), Parse, TryParse, FromDouble, Zero, MinValue, MaxValue, Scale, and ScaledValue continue to work.