Where would you put the return?

Benoit St-Jean bstjean at yahoo.com
Mon May 19 16:53:40 UTC 2003


While we're in KCP mode, I was wondering if there was
any good reason for the following code in
Object>>#isKindOf:

isKindOf: aClass 
	"Answer whether the class, aClass, is a superclass or
class of the 
	receiver. "
	self class == aClass
		ifTrue: [^ true]
		ifFalse: [^ self class inheritsFrom: aClass].


Why isn't it written like that:

^self class == aClass
		ifTrue: [true]
		ifFalse: [self class inheritsFrom: aClass].

Just curious.  You can find similar "multiple returns"
in a few places in the image...  Not really important
but I prefer the "cleaner" version...

My 2 cents.


=====
-----------------
Benoit St-Jean
Yahoo! Messenger: bstjean
A standpoint is an intellectual horizon of radius zero. -- Albert Einstein



More information about the Squeak-dev mailing list