All Downloads are FREE. Search and download functionalities are using the official Maven repository.

samples.categories.methods.operator.pec Maven / Gradle / Ivy

There is a newer version: 0.0.74
Show newest version
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 - 2024 Weber Informatics LLC | Privacy Policy