Charles Campbell wrote:

> I know this is a "late date", but I think it would be helpful if
> 
>   for var in list
>   ...
>   endfor
> 
> would complete with var= "".  For example where this might come in handy:
> 
> for home in split(&rtp,',')
>   if isdirectory(home) | break | endif
> endfor
> 
> So, if the loop was unsuccessful, then "home" would be an empty.  If its 
> successful, home
> is set to something useful.   Easy to test without extra clutter such as 
> test variables.

This for loop is like it is in Python, and it has proven to be very
useful.

It's easy to add something to the list if you want to loop over more
things.  E.g.:

         for home in split(&rtp,',') + ['']
           if isdirectory(home) | break | endif
         endfor

-- 
CUSTOMER:     You're not fooling anyone y'know.  Look, isn't there something
              you can do?
DEAD PERSON:  I feel happy... I feel happy.
    [whop]
CUSTOMER:     Ah, thanks very much.
MORTICIAN:    Not at all.  See you on Thursday.
CUSTOMER:     Right.
                                  The Quest for the Holy Grail (Monty Python)

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

Reply via email to