Excerpts from niva's message of Wed Apr 20 21:25:48 +0200 2011:
> Hi,
> 
> 
> I am writing a vimscript that contains recursivecondition block.
> 
> if cond1
> 
> else
>   if cond2
>   else
>      if condN
>      else
>      ....
>      endif
>   endif
> endif
> 
> How canI code to avoidrecursive conditional block and have an object
> approach?

Talk about your use case. Copy paste more code so that we know what the
hell you're talking about. I don't see "object usage here".

let conditions = [['a=7','echo "7"'],['a=8','echo "8"']]

for [c,action] in conditions
  exec 'let c_result = '.action
  if c_result
    exec action
  endif
  unlet c, c_result, action
endfor

This still sucks and I'm not sure that
this is what you're looking for.
Instead of "exec" you could be using call('functionname',...)

If you have to do real programming use one of the many :h if_<tab>
implementations.

Marc Weber

-- 
You received this message from the "vim_use" 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

Reply via email to