Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
21
Task/Classes/Wren/classes.wren
Normal file
21
Task/Classes/Wren/classes.wren
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
class Bear {
|
||||
// Constructs a Bear instance passing it a name
|
||||
// which is stored in the field _name
|
||||
// automatically created by Wren.
|
||||
construct new(name) { _name = name }
|
||||
|
||||
// Property to get the name
|
||||
name { _name }
|
||||
|
||||
// Method to make a noise.
|
||||
makeNoise() { System.print("Growl!") }
|
||||
}
|
||||
|
||||
// Create a new Bear instance and assign a reference to it
|
||||
// to the variable b.
|
||||
var b = Bear.new("Bruno")
|
||||
|
||||
// Print the bear's name.
|
||||
System.print("The bear is called %(b.name).")
|
||||
// Make a noise.
|
||||
b.makeNoise()
|
||||
Loading…
Add table
Add a link
Reference in a new issue