mIRC Homepage

[Solved] How to use while loops?

Posted By: G16

[Solved] How to use while loops? - 17/10/17 11:18 PM

Code
Quote:

/hmake guessgame
/hmake score

on *:text:!guess *:#:{
if ($regex($2,^[1-24]$)) {
/hadd -ms guessgame $nick $2-
}
}

on *:text:!winner *:#:{
var %w = $hfind(guessgame, $2-,0).data
var %i = 1
while (%i <= %w){ ;<-- this was incorrect
//echo -a $hfind(guessgame, $2-,1).data
/hdel guessgame $hfind(guessgame, $2-,1).data
inc %i
}
}
Posted By: maroon

Re: How to use while loops? - 18/10/17 01:48 AM

the first time you had the curly brace touching the parenthesis in front of it, the 2nd time you had the curly brace on the next line. Just have the curly brace on same line as the while:

Code:
while (condition to end loop) {
  stuff
}
Posted By: G16

Re: How to use while loops? - 18/10/17 03:13 AM

LoL
Thanks man, you rock!
© 2020 mIRC Discussion Forums