smalltalk block - can I explicitly set the returning value and stop executing the block?
问题 The return value of #value: message, when sent to a block, is the value of the last sentence in that block. So [ 1 + 2. 3 + 4. ] value evaluates to 7. I find that hard to use sometimes. Is there a way to explicitly set the returning value and stop executing the block? For exercise, try rewriting this block without using my imaginary #return: message and see how ugly it gets. I must be missing something. [ :one :two | one isNil ifTrue: [ two isNil ifTrue: [ self return: nil ] ifFalse: [ self