[Pharo-project] newbie smalltalk question
I have the following code: isValid (self value == nil and: [self required == false]) ifTrue: [^true]. self isCorrectType ifFalse: [self validationError: 'value doesn''t coerce to correct type'. ^false.] ^ self allConditionsValid. when I try to save this I get a ' Nothing more expected ->' right before '^ self allConditionsValid'. I'm guessing this is because I have the '^false' in the second line? How would I accomplish the same thing - correctly? Thanks, Elliot
On Thu, Dec 2, 2010 at 9:49 PM, Elliot Finley <efinley.lists@gmail.com>wrote:
I have the following code:
isValid (self value == nil and: [self required == false]) ifTrue: [^true]. self isCorrectType ifFalse: [self validationError: 'value doesn''t coerce to correct type'. ^false.] ^ self allConditionsValid.
when I try to save this I get a ' Nothing more expected ->' right before '^ self allConditionsValid'. I'm guessing this is because I have the '^false' in the second line?
You are missing a period after the close of the block. You have a period /before/ the end of the block, which is unnecessary. Move it to the other side of the ']'. best Eliot
How would I accomplish the same thing - correctly?
Thanks, Elliot
On Thu, Dec 2, 2010 at 10:59 PM, Eliot Miranda <eliot.miranda@gmail.com>wrote:
On Thu, Dec 2, 2010 at 9:49 PM, Elliot Finley <efinley.lists@gmail.com>wrote:
I have the following code:
isValid (self value == nil and: [self required == false]) ifTrue: [^true]. self isCorrectType ifFalse: [self validationError: 'value doesn''t coerce to correct type'. ^false.] ^ self allConditionsValid.
when I try to save this I get a ' Nothing more expected ->' right before '^ self allConditionsValid'. I'm guessing this is because I have the '^false' in the second line?
You are missing a period after the close of the block. You have a period /before/ the end of the block, which is unnecessary. Move it to the other side of the ']'.
<me turning bright red with embarrassment>
Thank you. </>
participants (2)
-
Eliot Miranda -
Elliot Finley