
samples.categories.methods.operator.pec Maven / Gradle / Ivy
define currency as Text attribute matching "[A-Z]{3}"
define value as Decimal attribute
define Amount as category with attributes currency and value, and methods:
define + as operator receiving Amount other doing:
return Amount with currency as currency and value + other.value as value
define main as method doing:
a = Amount with "USD" as currency and 2000.0 as value
b = Amount with "USD" as currency and 4000.0 as value
printLine "a + b -> " + (a + b)
© 2015 - 2025 Weber Informatics LLC | Privacy Policy