Return

From Scriptwiki
Revision as of 10:44, 14 September 2005 by Microbe (talk | contribs) (added / and changed $null thingy)

Jump to: navigation, search

Halts a currently executing script and allows the calling routine to continue processing.

/return [value]

You can also optionally specify a return value which will be stored in the $result identifier. The $result identifier can then be used in the calling routine.

Value is optional. If value isn't specified, $return and the (possible) custom identifier give you $null.

Example

var %c = 1
while (%c <= 10) {
  echo -a %c
  if (%c == 5) { return }
  inc %c
}

Echos values from 1 to 5.

alias foo { return Today, it's the $asctime(dd.mm.yyyy) }
//echo -a $foo

This will echo 'Today, it's the <current date>', as $foo returns it.

See Also