coffeemaker.lox (248B)
1 class CoffeeMaker { 2 init(coffee) { 3 this.coffee = coffee; 4 } 5 6 brew() { 7 print "Enjoy your cup of " + this.coffee; 8 9 // No reusing the grounds! 10 this.coffee = nil; 11 } 12 } 13 14 var maker = CoffeeMaker("coffee and chicory"); 15 maker.brew();