One of the people on this board has in their signature - Programming is 99% logic & 1% syntax . (how true) So this is about that 99%.....
I'm trying to compare an input with each of 25 particular fields in a database record, then ....
if it matches any of the 25 fields -> call function(a)
if it matches none of the 25 fields ->call function(b)
What I've come up with so far is to create a loop reading each of the 25 fields and doing a strcmp with the field and the input. If it gets a match ->break then call function(a). This part works fine.
Where I'm stuck is how to call function(b) ONLY if ALL of the 25 loops fail to find a match. Since strcmp returns 0 for a match and either a + or- value for a "not match" I can't think of any way of using any kind of "sum". And if I use a simple "if ! O" to call function(b) then I get function(b) called for numerous times for every round of the loop that doesn't match.
It might be that I'm using a completely flawed logic on this - I'm still pretty new to this programming stuff.
Any suggestions are appreciated,