Home Segments Index Top Previous Next

136: Mainline

In addition to predicates for testing numbers, Smalltalk offers other predicates, such as isInteger and isString, that test instances to determine whether those instances belong to particular classes:

Workspace
Transcript show: 4 isInteger printString; cr; 
           show: 4 isString printString; cr; 
           show: 'four' isInteger printString; cr; 
           show: 'four' isString printString; cr 
Transcript 
true 
false 
false 
true