[Newbies] Testing = and == in workspace

Ben Coman btc at openInWorld.com
Sat Jan 7 05:15:01 UTC 2012


I was trying to confirm the operation of = and == in the workspace by 
executing the following code..

x :=  'xxx'.
y :=  'xxx'.
z := x.
(OrderedCollection new) add: (x = y) ; add: (x == y) ; add: (x=z); add: 
(x==z); yourself.

I was confused that I was getting anOrderedCollection(true true true true)

It was not until I changed to the following code...

x := String newFrom: 'xxx'.
y := String newFrom: 'xxx'.
z := x.
(OrderedCollection new) add: (x = y) ; add: (x == y) ; add: (x=z); add: 
(x==z); yourself.

that I got the expected anOrderedCollection(true false true true)

I was curious what was going on in the first case.

cheers, Ben


More information about the Beginners mailing list