What is the equivalent of switch case (or case expr of) in
Slate?
Brian Rice
water at tunes.org
Fri Apr 1 09:30:39 PST 2005
caseOf:otherwise: takes an Array of Associations between blocks, and a
fail-over block if no case applies. We lifted it straight from
Smalltalk-80. It also has a byte-compiler optimization.
On Apr 1, 2005, at 9:20 AM, Paul Dufresne wrote:
> In my SDL event looking code, I am doing:
> SDL waitEvent: evt.
> evt_type: evt TypeEvt.
> evt_type == SDL KEYDOWN ifTrue: [et showKeyDown: evt ].
> evt_type == SDL KEYUP ifTrue: [et showKeyUp: evt ].
> evt_type == SDL MOUSEBUTTONDOWN ifTrue: [et showClick: evt ].
> evt_type == SDL MOUSEMOTION ifTrue: [et showMouseMove: evt ].
> "I'd like to call showOther if it is none of the previous, but..."
>
> but I would have to make an if different than SDL KEYDOWN, and
> different
> than SDL KEYUP and differnt than ...
>
> That seems to long.
> What would be a better way to do this?
> Hope this is not in the manual.
--
Brian T. Rice
LOGOS Research and Development
http://tunes.org/~water/
More information about the Slate
mailing list