[Pharo-project] Block with ^ examples ...
Hi All, I want to write some more tests for Redline Smalltalk block handling. Where can I find a really good description of how blocks with ^ in them are handled? ie: [ ^ true. ] Rgs, James.
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.
participants (2)
-
Helene Bilbo -
James Ladd