Basically

ifTrue: aBlock

is equivalent to:

ifTrue: aBlock ifFalse: [ ]

This is why ifTrue: answers nil if the receiver is false, because the evaluation of an empty block answers nil ( [ ] is the same thing as [ nil ] ).

So you have to write it explicitly. The #and: version is probably the best :-).

2015-04-02 9:12 GMT-07:00 Anne Etien <anne.etien@univ-lille1.fr>:

Le 2 avr. 2015 �� 18:02, Max Leske <maxleske@gmail.com> a ��crit :


On 02 Apr 2015, at 17:31, Peter Uhn��k <i.uhnak@gmail.com> wrote:

>�� �� �� ��^ (a=b) ifTrue: [ aBlockCheckingConditions].

Boolean is still just an object, so you can use a cascade
^ (a=b)
�� �� ifTrue: [ aBlockCheckingConditions];
�� �� yourself

But that will always return the the boolean from the first statement! If you want to return something from the conditions block you can���t do that.

An alternative might be��

^ a = b and: [ condition ]

Yes!! Good idea.
Thanks.
Anne


Peter