Object subclass: #Switch
    instanceVariableNames: 'value satisfied response'
	classVariableNames: ''
	poolDictionaries: ''
	category: 'Objectspace.net-Controlling Structures'
Switch>>for: anObject
   ^self new value: anObject 
Switch>>isSatisfied
   ^satisfied == true
Switch>>case: oneArgTestBlock then: execBlock
   "The oneArgTestBlock must return a Boolean value
   when ==passed the value of the receiver."

   self isSatisfied ifFalse:[
      (oneArgTestBlock value: self value) ifTrue:[
         self response: execBlock value.
         self satisfied: true]].
Switch>>default: execBlock
   self isSatisfied ifFalse: [
	self response: execBlock value].
   ^self response 
(Switch for: x)
   case: [:value | value = 1] then: ["..."];
   case: [:value | value = 2] then: ["..."];
   default: ["..."]  
Switch>>caseIs: testObject then: execBlock
   self
	case: [:value | testObject = value]
	then: execBlock. 
(Switch for: x)
   caseIs: 1 then: ["..."];
   caseIs: 2 then: ["..."];
   default: ["..."]
Switch>>caseIsAny: testCollection then: execBlock
   self
	case: [:value | testCollection includes: value] 
	then: execBlock. 
Object>>switch
   ^Switch for: self 
x switch
   caseIs: 1 then: ["..."];
   caseIs: 2 then: ["..."];
   default: ["..."] 
Object>>switch
   ^Switch for: self value
[x\*10] switch
   caseIs: 1 then: ["..."];
   caseIs: 2 then: ["..."];
   default: ["..."]