それを行うより良い方法はありますか:
|aBlock|
aBlock := [3+2].
aBlock := Object readFrom: (a printString copyReplaceAll: '3' with: '2').
?
編集このコードは単なる例であり、次のようなものはどうですか:
[:something |
something checkSomethingElse ifNil:
[whatever]
ifNotNil:
[something getSomethingDone]]
checkSomethingElse の代わりに checkAnotherThing が必要な場所。
また:
[:oneParameter :anotherParameter |
oneParameter doSomethingWith: anotherParameter]
ここで、3 番目のパラメーターを追加します。
[:oneParameter :anotherParameter :yetAnotherParameter |
oneParameter doSomethingWith: anotherParameter and: yetAnotherParameter]