[newbie] Complex boolean value?
JArchibald at aol.com
JArchibald at aol.com
Mon Jun 18 10:02:16 UTC 2001
=> 6/17/01 2:20:17 PM EDT, fuxoft at terminal.cz =>
<< ((value < 1 or: [value > x1]) or: [value > x2])
ifTrue: [self error: 'Invalid value'].
It works, but it looks rather complex. How to do this more "cleanly",
with less parentheses? >>
Since Smalltalk has a light weight syntactic protocol, it creates the need
for "additional" parentheses in certain cases.
I have usually treated complex Boolean expressions as a formatting issue, and
usually write something like:
((value < 1 or:
[ value > x1 ]) or:
[ value > x2 ]) ifTrue:
[self error: 'Invalid value'].
and, of course, there are a lot of suggestions from others that preceded this.
Cheers,
Jerry.
____________________________
Jerry L. Archibald
systemObjectivesIncorporated
____________________________
More information about the Squeak-dev
mailing list
|