hmm.

When I try this on P7

|input stepChanges floor|
input := '((('.
floor := 0.
stepChanges := input collect: [ :c |
    floor := floor + (c = '(' ifTrue: [ 1 ] ifFalse: [ -1 ]).
    floor
].

stepChanges detectIndex: [ :each | each = -1 ] ifNone: [ 'invalid input yo' ].

then I see this error message :  Improper store to indexable object.

Roelof


Op 9-11-2018 om 17:39 schreef Roelof Wobben:
stepChanges := input collect: [ :c |
floor := floor + (c = '(' ifTrue: [ 1 ] ifFalse: [ -1 ]).
floor
].

stepChanges detectIndex: [ :each | each = -1 ] ifNone: [ 'invalid input yo' ].

Reply via email to