[Newbies] Assignment

Maurice van Peursem squeak at vanpeursem.net
Fri Aug 10 00:25: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".

Ah, that would explain a lot. Very confusing when there are typos in 
a teaching manual...

>>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.

No, I'm pretty sure you are wrong here, := is assignment, = means 
equals, and == means identical. The difference is not explained, but 
I take it as value equals vs. pointer equals. That is why I'm 
confused, I would expect an = here, not an ==.


But there are errors in this document also, I hate it when I can't be 
sure of a supposedly complete reference.

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

Yeah, the assignment is lost in all statements. Maybe they used the 
underscore, and that got lost in the PDF?


More information about the Beginners mailing list