in reply to Re: Search string within an predefined array
in thread Search string within an predefined array

I have often had a similar challenge and have almost always used the method that moritz suggests. I find it's simple, clean and provides a strategy that works for arbitrarily complex, nested if() statements.

One thing I've been trying to do, however, is to actually put the code that needs to be executed (in your case when the if()'s first test is TRUE) in the body of the block that the if() goes to. That way, at least IMHO, it is even more obivious (e.g., 'reader friendly').

However, I have also found that such a strategy only works if (1) the block of code to execute is short enought that readers don't loose track of which enclosing if() clause it belongs to and (2) there aren't a lot of if() clauses or nestings.

So, by and large, I stick with the method that moritz recommended.

ack Albuquerque, NM
  • Comment on Re^2: Search string within an predefined array