[Block] whileFalse: [block] | Manual

[Block] whileFalse: [block]

Runs a block of code, depending on the outcome runs the other block as long as the result of the first one equals to False.

 x := 0.
 { ^(x > 5). }
 whileFalse: { x add: 1. }. #increment x until it reaches 6.

 Here we increment variable x by one until it reaches 6.
 While the number x is not higher than 5 we keep incrementing it.
 Don't forget to use the return ^ symbol in the first block.

back to homepage
back to manual menu

This API reference guide has been generated automatically from source code comments using the shtml.ctr script.