kyleect / locks

A toy language branched from Lox to learn language implementation and tooling. Forked from loxcraft
https://kyleect.github.io/locks/#/docs
MIT License
0 stars 0 forks source link

Getters/Setters #46

Open kyleect opened 8 months ago

kyleect commented 8 months ago
class KeyValue {
  let key;
  let value;

  fn init(key, value) {
    this.key = key;
    this.value = value;
  }

  get fn formatted() {
    return this.key + "=" + this.name;
  }
}

let keyValue = KeyValue("key", "value");

print keyValue.formatted; // out: key=value