Home Segments Index Top Previous Next

627: Mainline

When used with numbers, the = predicate answers true if two numbers are numerically equal, even if they are not the same instance:

Number method definition • instance 
testTwoNumbers: aNumber 
  Transcript show: (self = self) printString; cr; 
             show: (self = aNumber) printString; cr; 
             show: (self == self) printString; cr; 
             show: (self == aNumber) printString; cr. 
Workspace
3 testTwoNumbers: 3.0 
Transcript 
true 
true 
true 
false