Class Expressions

The class syntax can also be used as an expression which can be assigned to a variable or explicitly returned.

MoonScript:

x = class Bucket
  drops: 0
  add_drop: => @drops += 1

results matching ""

    No results matching ""