On Mon, Jun 11, 2007 at 08:56:22PM +0200, Lukas Ocilka wrote:
http://forgeftp.novell.com/yast/doc/SL10.2/tdg/YCPBuiltinList_foreach.html
According to the link mentioned above, "return" in "foreach" should return the last value value from "foreach".
For the iterating builtins like foreach, filter, maplist, and others, "return" only affects the iterating block. But that means that we should fix the docs for "return" to mention it. On Mon, Jun 11, 2007 at 07:19:17PM +0100, Benji Weber wrote:
The documentation (http://forgeftp.novell.com//yast/doc/SL10.2/tdg/id_ycp_return.html) states:
The return statement immediately leaves the current function or a current top level block (that contains it) and optionally assigns a return_value to this block. If blocks are nested, i.e. if the current block is contained in another block, the return statement leaves all nested blocks and defines the value of the outermost block.
Well the next paragraph in fact does mention it: "However, if a block is used in an expression other than a block, and that expression is contained in an outer block, the return statement of the inner block won't leave the outer block but define the value of the inner block. This behavior is a as one would expect. For example in the iteration builtins in Section 8.16, “Applying Expressions To Lists And Maps”," Benji perhaps you can suggest better wording to make the point easier to understand. -- Martin Vidner, YaST developer http://en.opensuse.org/User:Mvidner Kuracke oddeleni v restauraci je jako fekalni oddeleni v bazenu -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org