Goto loops

From Scriptwiki
Jump to: navigation, search

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 
  inc %i
  if (%i > $chan(0)) { return %chans }
  var %chans = %chans $chan(%i)
  goto nexti

Sometimes you may wish to use goto not in connection with 'loops', an example of which is below:

alias Eat {
  if ($istok(Apples Pears Nothing,$1,32)) goto $1
  echo -at *** You don't fancy anything to eat? I don't know what $1 is.

  echo -at *** You just ate an apple!

  echo -at *** You just ate a pear!

  echo -at *** Not hungry? You haven't eaten anything.

See Also