mIRC Home    About    Download    Register    News    Help

Print Thread
#255654 11/11/15 04:42 PM
P
Perl
Perl
P
hello, I make a loop to see if there is a variable, but I have tried several options and are unsuccessful.

Code:

        set %a 1
        while (%a <= 10) {
          set %sumavid variable $+ %a
          if (%sumavid == $null) { echo -s create | halt }
          else { echo -s dont create }
          inc %a
        }



It does not work


Code:
  set %a 1
        while (%a <= 10) {
          if (% $+ variable $+ %a == $null) { echo -s create | halt }
          else { echo -s dont create }
          inc %a
        }


either

an alternative to increase the variable name %var1 %var2 %var3 ... in while witch inc %a ,
would be different variables

Last edited by Perl; 11/11/15 04:58 PM.
#255656 11/11/15 05:29 PM
Joined: Dec 2008
Posts: 1,483
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,483
Try use this method:

Code:
alias test_if {
  var %a 1
  while (%a <= 10) {
    var %chk = %variable [ $+ [ %a ] ]
    if (!%chk) { echo -s create | halt }
    else { echo -s dont create }
    inc %a
  }
}


/help [ ] evaluation brackets

westor #255658 11/11/15 06:47 PM
P
Perl
Perl
P

thanks, I have checked the brackets and has solved my problems, thanks and greetings.

Originally Posted By: westor
Try use this method:

Code:
alias test_if {
  var %a 1
  while (%a <= 10) {
    var %chk = %variable [ $+ [ %a ] ]
    if (!%chk) { echo -s create | halt }
    else { echo -s dont create }
    inc %a
  }
}


/help [ ] evaluation brackets


Link Copied to Clipboard