Entering the whileTrue: object at the st> prompt causes a parser error

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

Entering the whileTrue: object at the st> prompt causes a parser error

highbeg
ifTrue: works as expected, whileTrue: fails. Is this behavior known, expected?

st> (true) ifTrue: ['foobar']
'foobar'
st> (true) whileTrue: ['foobar']
Object: true error: did not understand #whileTrue:
MessageNotUnderstood(Exception)>>signal (ExcHandling.st:254)
True(Object)>>doesNotUnderstand: #whileTrue: (SysExcept.st:1448)
UndefinedObject>>executeStatements (a String:1)
nil
st>
Reply | Threaded
Open this post in threaded view
|

Re: Entering the whileTrue: object at the st> prompt causes a parser error

Paolo Bonzini-2
On 04/01/21 22:06, Gary Highberger wrote:

> ifTrue: works as expected, whileTrue: fails. Is this behavior known, expected?
>
> st> (true) ifTrue: ['foobar']
> 'foobar'
> st> (true) whileTrue: ['foobar']
> Object: true error: did not understand #whileTrue:
> MessageNotUnderstood(Exception)>>signal (ExcHandling.st:254)
> True(Object)>>doesNotUnderstand: #whileTrue: (SysExcept.st:1448)
> UndefinedObject>>executeStatements (a String:1)
> nil
> st>

Hi,

the receiver of #whileTrue: is a block.  The following works:

[true] whileTrue: ['foobar' printNl]

Paolo