Difference between revisions of "Goto loops"

From Scriptwiki
Jump to: navigation, search
m (cleaning wanted pages-list)
 
m (changed example to a loop..)
Line 2: Line 2:
 
Goto's aren't used very much.
 
Goto's aren't used very much.
  
  alias testmsg {
+
  alias channels {
   if ($1 == ahihi) { goto ahihi }
+
   [var] %i , %chans
   elseif ($1 == kiaa) { goto kiaa }
+
  :nexti
   else { echo -ag try again! }
+
  [inc] %i
+
  [if] (%i > [$chan](0)) { [return] %chans }
  :ahihi
+
   var %chans = %chans $chan(%i)
  msg #channel ahihi
+
   [goto] nexti
  halt
 
 
  :kiaa
 
  msg #channel kiaa
 
  halt
 
 
  }
 
  }

Revision as of 00:29, 31 October 2006

You can use goto command to jump from one point to another in a script.
Goto's aren't used very much.

alias channels {
  [var] %i , %chans 
  :nexti
  [inc] %i
  [if] (%i > [$chan](0)) { [return] %chans }
  var %chans = %chans $chan(%i)
  [goto] nexti
}