Hi,

I haven't run your code, but I guess that the validation of the number of arguments of the block is failing.
The block [ 42 ] is a block with zero arguments, but when you do a value: 20, you are calling it with one argument. So it fails.

Happy Coding!

Santiago Dandois


El dom., 5 ene. 2020 a las 13:08, xap (<xap@router.33mail.com>) escribi��:
hi, I'm starting out w/ pharo (as my first smalltalk-ish language). am on
Windows 7 professional; downloaded 64-bit, pharo 8 64-bit development; then
downgraded to pharo 7, 32-bit stable.
I went through Prof Stef, and find 1 place of unexpected behavior:

Prof Stef/Conditionals:

"no surprises, prints 100"
1 < 2
�� ifTrue: [100]
�� ifFalse: [42].

"i added a, as below, and get an error -- i would've expected a to refer to
the block, and to be evaluable later, similar to the just prior example in
ProfStef/Block assignation"

|a|
a := 1 < 2
�� ifTrue: [:x|x+1]
�� ifFalse: [42].
a value: 20.

What am I missing, pls?




--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html