Wednesday, March 30, 2011

If/Else for a Catch statement?

Hi,

I would like to do something like this, to process exceptions:

try
if catch /pattern/
do this and that
else
do the ordinary thing
endif
endtry

Of course this is not real code, but catches do act like an ``if'', but I do
not know of a clean way to do an `else'. My sloppy solution was to define a
variable to do it like this:

try
let s:number = 0
catch /pattern/
do this and that
let s:number = 1
finally
if number < 1
do the ordinary things
endif
endtry

Any better way to do an if/else conditional, with a catch statement?


================================================
{ PLEASE CHANGE YOUR EMAIL CONTACT LIST! }
{ If I am listed as howardb@sfo.com, change my }
{ address to howardb21@gmail.com }
================================================

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

No comments:

Post a Comment