[Newbies] Assignment

Blake blake at kingdomrpg.com
Thu Aug 9 23:45:23 UTC 2007

On Thu, 09 Aug 2007 16:24:03 -0700, Maurice van Peursem  
<squeak at vanpeursem.net> wrote:

> What exactly does the following line mean?
> cr Character cr.

A typo? Unless by some means I don't understand a nil object is supposed  
to understand the message "Character".

> I (as Perl programmer) would write:
> cr := Character cr.

I would think that's right.

> [:c | c = cr ifTrue: [count count + 1]].

Smalltalk has "=" and "==" as assignment and comparison respectively. So  
you need the "==" to compare c to cr.

It also should be "count := count + 1", I believe.

More information about the Beginners mailing list