[Date Index][Thread Index]
[Date Prev][Date Next][Thread Prev][Thread Next]

Re: <break> when using included <while> tags



On Tue, Jul 31, 2001 at 11:03:42AM +0200, Ghislaine Labouret wrote:
> Is there a way to make the <break> tag act on the _current_ while loop,
> instead of the innermost one? Or maybe another way to get the same 
> result...
> 
> To make myself clear, here is the current behaviour of this tag:
> 
> Exemple from the doc:
> Source
>   <set-var i=10>
>   <while <gt <get-var i> 0>>;;;
>     <get-var i> <decrement i>;;;
>     <ifeq <get-var i> 5 <break>>;;;
>   </while>
> Output
> 10 9 8 7 6
> 
> But if I add another while loop, than the <break> affects the next
> instance of that inner loop, which is not what I want:
> Source
>   <set-var i=10>
>   <while <gt <get-var i> 0>>;;;
>     <get-var i> <decrement i>;;;
>   <ifeq <get-var i> 5 <break>>;;;
>     <set-var j=1>
>     <while <lt <get-var j> 3>>;;;
>       <get-var j> <increment j>;;;
>     </while>
>   </while>
> Output
> 10
>   1 2
> 9
>   1 2
> 8
>   1 2
> 7
>   1 2
> 6
> 5
>   1 2
> 4
>   1 2
> 3
>   1 2
> 2
>   1 2
> 1
>   1 2

Hi Ghislaine,

this is obviously a bug.  In fact, I should have never introduced this
<break> tag, because I cannot find a solution to make it work as
expected :(

-- 
Denis Barbier
WML Maintainer
______________________________________________________________________
Website META Language (WML)                www.engelschall.com/sw/wml/
Official Support Mailing List                   sw-wml@engelschall.com
Automated List Manager                       majordomo@engelschall.com