有没有比这更好的方法:
|aBlock|
aBlock := [3+2].
aBlock := Object readFrom: (a printString copyReplaceAll: '3' with: '2').
?
编辑这段代码只是一个例子,比如:
[:something |
something checkSomethingElse ifNil:
[whatever]
ifNotNil:
[something getSomethingDone]]
现在我想在哪里检查AnotherThing 而不是checkSomethingElse。
或者:
[:oneParameter :anotherParameter |
oneParameter doSomethingWith: anotherParameter]
现在我想在哪里添加第三个参数并且:
[:oneParameter :anotherParameter :yetAnotherParameter |
oneParameter doSomethingWith: anotherParameter and: yetAnotherParameter]