This is probably not what you are looking for, but it helped me, an amateur,
to understand return statements in blocks. Perhaps it would be a good
beginners example for the Block-Chapter in PBE Volume 2:
ReturnEarlyTest>>returnEarly
"The evaluation of the BlockClosure [^ true] per #value in True>>ifTrue:
will not (only) end the block, but it's home context, i.e. this method,
#returnEarly."
1 = 1 ifTrue: [^ true].
^ false
ReturnEarlyTest>>testReturnEarly
"Test if the method returnEarly does indeed return early :)"
self assert: ((self returnEarly) = true)
Best regards,
Helene.
--
View this message in context:
http://forum.world.st/Block-with-examples-tp4563742p4564395.html
Sent from the Pharo Smalltalk mailing list archive at Nabble.com.