Code:
var %x = 0, %xx = [color:red]10[/color]
while (%x < %xx) {
  inc %x
  if ($nick isin $+(%thinga,%x)) {
    ;do something here 
  }
  else {
    ;do something else here
  }
}


The number of times you want this to happen

-genius_at_work