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.

-- 
CART DRIVER: Bring out your dead!
LARGE MAN:   Here's one!
CART DRIVER: Ninepence.
BODY:        I'm not dead!
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
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