wu-lang/wu

[feature] Enums

nilq opened this issue · 0 comments

nilq commented

Enums will be simple. My current idea is to have something like the following:

import enemies { Enemy }

Weapon: enum {
  Gun
  Swordfish
  Fist
}

damage_enemy_with: fun(enemy: Enemy, weapon: Weapon) {
  switch weapon {
    Weapon Gun => enemy damage(100)
    Weapon Swordfish => enemy damage(9000)
    Weapon Fist => enemy damage(10)
  }
}

Again; very simple. :)