Last active
May 25, 2021 10:19
-
-
Save germandiagogomez/04097ed03ecd64581fed78e421802527 to your computer and use it in GitHub Desktop.
Classes in Wren
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Counter { | |
construct new(withValue) { | |
_currentValue = withValue | |
} | |
increment() { | |
_currentValue = _currentValue + 1 | |
} | |
value { _currentValue } | |
} | |
var c = Counter.new(0) | |
for (v in in 1...10.where{|e| e % 2 == 0) { | |
System.print("%(v)") | |
c.increment() | |
System.print("%(c.value)") | |
} | |
for (e in ["hello", "world"]) { | |
System.print("%(e)") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment