On 15:33 Sat 22 Mar     , Bram Moolenaar wrote:
> 
> ZyX wrote:
> 
> > Consider the following script:
> > 
> >     execute 'if 0'
> >         echo 'Not shown'
> >     else
> >         echo 'Shown'
> >     endif
> > 
> > . If you source it you find that instead of 3 errors (“missing
> > :endif”, “:else without :if”, “:endif without :if”) and two messages
> > (“Not shown” and “Shown”) you will see one message (“Shown”) and no
> > errors.
> > 
> > Note that `execute 'if 0'` is explicitly forbidden in help:
> > 
> > >                   Note: The executed string may be any command-line, but
> > >                   you cannot start or end a "while", "for" or "if"
> > >                   command.  Thus this is illegal:
> > >           :execute 'while i > 5'
> > >           :execute 'echo "test" | break'
> 
> The docs are wrong, using "if" is allowed.  The other two are not.

Well, this script works just fine for me:

let i = 0
execute 'while i < 10'
    let i += 1
    echo 1
endwhile

also this one works:

execute 'for i in range(10)'
    echo i
endfor

Best regards,
Marcin Szamotulski

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui