How can I ensure that really in case of error or not a piece of code is 
executed.
Now I'm totally confused by the semantics of ensure: 

So I wrote that:

testOnDo
        "self run: #testOnDo "
        
        self doOnDo: [ self error].
        self assert: x = 3.
        x := 77.
        self doOnDo: [x = 21].
        self assert: x = 3



ensure
        x := 3

doOnDo: aBlock 
        x := 5.
        [aBlock value.
        self ensure] on: Error do:  [:ex | self ensure].

Reply via email to