I sometimes see Smalltalk code that tests a condition by stating the opposite of what it wants to test in the condition then sending ifFalse:. For example, you might say aCollection isEmpty ifFalse: [self doSomething]. This normally strikes me as a more difficult way to say things. I would much rather make the condition positive and change the test to ifTrue:. For example, aCollection notEmpty ifTrue: [self doSomething]. Stating the opposite of what you want and checking it with an ifFalse is just tricky. Making your condition positive makes the statement easier to understand.
Download