SelectCase
Ragnar Hojland Espinosa
ragnar at ragnar-hojland.com
Tue Jan 3 13:24:59 UTC 2006
> I know select/case statements is not desired in the squeak community
> and I understand why (it's often a wrong modelisation). But I put
> an implementation in squeaksource which can be used like this :
>
> (aString selectCase )
> testBlock: [:ref :case | case match: ref];
> case: 't*' exec: [self assert: false];
> case: 'v*' exec: [self assert: true];
> case: 'value' exec: [self assert: false];
> default: [^ nil]
>
> #testBlock: and #default: can be ommited.
What's wrong with
http://wiki.cs.uiuc.edu/CampSmalltalk/Smalltalk+case-statement ?
BTW, I do prefer the case:then: selector better than the case:exec:
More information about the Squeak-dev
mailing list
|