Where would you put the return?
Boris Gaertner
Boris.Gaertner at gmx.net
Mon May 19 17:30:18 UTC 2003
Benoit St-Jean <bstjean at yahoo.com> asked:
> 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].
>
Why is't it written like that:
^self class == aClass or: [self class inheritsFrom: aClass]
My 2 eurocents.
More information about the Squeak-dev
mailing list
|