[Newbies] >> notation

Stuart Herring stuartrh at gmail.com
Thu Nov 30 07:33:34 UTC 2006


On 11/30/06, Another Dave <dooright101 at yahoo.com> wrote:
>
> I'm having trouble understanding the '>>'  in some Smalltalk programs, Such
> as this, from Smalltalk By Example:
>
> MyClass>>doThis
>  array := Array new: 3.
>  array at: 1 put: 2.
>
> I can understand that we are creating a new 3-place instance of Array, named
> array, and putting 2 in the first slot. But I don't understand what MyClass,
> >>, or doThis are doing.

The ">>" is just a way of indicating that you're talking about a message name.

In your example, MyClass is the class name, and doThis is the message
name.  You'll never actually enter the ">>" when defining a message,
instead you'd put the code in the doThis message of MyClass in the
browser.

Regards,
Stuart.


More information about the Beginners mailing list