Exploring fields and methods
Fields and methods allow us to provide properties and actions to our objects. The use of specialized terms instead of variables and functions will enable us to identify that they are only accessible through the instance of an object. They have a limited scope, and their life cycle is determined by the instance’s life cycle.
We can declare a field in the same way as we do with variables. The following are a few examples:
entity Baz { field a: Int = 5; // With type and value field b: Int; // With type field c; // Just the field name }
The fields can include a type or a value as you deem necessary. It is important to remember that they are mutable, so their value can be altered...