and: help

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

and: help

Jeff Gray
I have a line of code that goes:
([self directoryName = ''] and: [self fileSpec = '']) ifTrue: [.....

and it throws an error "NonBooleanReceiver: proceed for truth".
The directoryName and fileSpec methods both ititialise to '' (empty string) if nil.

I couldn't see what the issue was so I played in a workspace and evaluated:
[true] and: [true]
which gave me the same error.

I'm in Pharo 1.1.1
Is my boolean structure wrong or is this a bug? Is there a better way for me to write the code?
Reply | Threaded
Open this post in threaded view
|

Re: and: help

Benoit St-Jean
((self directoryName = '') and: [self fileSpec = '']) ifTrue: [something]

Note the receiver of #and: is NOT a block
 
-----------------
Benoit St-Jean
Yahoo! Messenger: bstjean
A standpoint is an intellectual horizon of radius zero.
(Albert Einstein)



From: Jeff Gray <[hidden email]>
To: [hidden email]
Sent: Mon, March 28, 2011 10:23:03 PM
Subject: [Pharo-users] and: help

I have a line of code that goes:
([self directoryName = ''] and: [self fileSpec = '']) ifTrue: [.....

and it throws an error "NonBooleanReceiver: proceed for truth".
The directoryName and fileSpec methods both ititialise to '' (empty string)
if nil.

I couldn't see what the issue was so I played in a workspace and evaluated:
[true] and: [true]
which gave me the same error.

I'm in Pharo 1.1.1
Is my boolean structure wrong or is this a bug? Is there a better way for me
to write the code?

--
View this message in context: http://forum.world.st/and-help-tp3413554p3413554.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|

Re: and: help

Jeff Gray
Excellent. Thanks Benoit. I think my sense of symmetry overtook my sense of Smalltalk :-)