Nested if istatment

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

i use 7 nested if statment but now i want to use more then it nearly 500
nested if statment please help
 
I'm not sure what the limit is on nested If statements, but I'm sure it is
well under 500. An If statement is not the way to go with that many
conditions, even if you could. Describe what you are trying to do. Somebody
will have a suggestion.
 
not sure what you are attempting here, but I can't imagine even the best
programmer being able to manage this level of 'ifs'

I suspect a mapping table of some sort would be the way to go.
 
Hi Faisal,

Usually a Select Case statement will replace complex nested IF statements
but 500 nested IFs just seems too deep to manage. I suspect that you're
trying to deal with too big a cluster of issues as though they were a single
related issue. Can you break down the problem into smaller chucks? Declare
a bunch of variables to hold interim results and then solve pieces of the
larger problem and store the results for final calculations at the end of
the calculations.

What ever the problem you're solving, it can be solved without nesting 500
IF statements.

If you need help, post back describing the problem you're trying to solve.

HTH
 
What ever the problem you're solving, it can be solved without nesting 500
IF statements.


Larry,
Wouldn't you just love to try to debug and IF statement nexted to 500
levels? I can already imagine the nightmares I would have if I had to work
on that one.
 
Hi Lynn,

Nope. The 500th power of 2 is a pretty big number!

I came onto some pretty wild jobs back in Assembler coding days. Always I
was told that the prior work was done by some genius but that the work was
so complex that no one could understand it (or why it did and/or didn't
work). After weeks or months of walking on egg shells and gradually
replacing the spaghetti code with somewhat better organized routines, the
lines of code would boil down to something less than 10% of the starting
number and the "complex" stuff would be simple and maintainable.

Recently someone posted a problem with nested IIFs only 3 levels deep. What
a mess! I remember being told by one of the Older and Wiser lads many years
ago that anyone nesting subroutines (or anything else) more than 6 levels
didn't really know what they were doing. I believed it then and still do.
:-)
 
Back
Top