Navigation:  Tutorials > Beginners Guide to Smalltalk > Programming in Smalltalk >

Time for a Test

Previous pageReturn to chapter overviewNext page

The good thing about Smalltalk is that it's really easy to test things quickly. Why don't we create an instance of Animal and see what we can do with it so far. In a workspace evaluate:

myAnimal := Animal new.


"Display the following"

myAnimal name.


"Now give it a name"

myAnimal name: 'Dog'.


"And display the name again"

myAnimal name.


These simple tests show how we can create a new instance of an Animal, assign a name to it and then query the name again.