What is the equivalent of switch case (or case expr of) in Slate?

Paul Dufresne dufresnep at fastmail.fm
Fri Apr 1 09:20:38 PST 2005


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.

--Paul




More information about the Slate mailing list