|
First of all, a loop can do that. Secondly, your explanation still isn't very complete.
You say if will find xx first, then look at the next. If it finds xx it doesn't (does that mean, "isn't supposed to"?) do anything.
You don't mention what it should do if it isn't xx. Use it? Take off and find the next xx? What do you want to do, and why is xx involved?
|