Return: Difference between revisions
Jump to navigation
Jump to search
added stub and category - needs an example of returning a value at least |
Added an example, changed so that it follows the mirc_help rules, added other minor stuff. |
||
Line 1: | Line 1: | ||
Halts a currently executing script and allows the calling routine to continue processing. | |||
/return [value] | /return [value] | ||
You can also optionally specify a return value which will be stored in the [[$result]] [[Identifiers|identifier]]. The $result can then be used in the calling routine. | |||
Value is optional. If identifiers doesn't return any existing value, the return [[$null]] by default. | |||
== Example == | |||
[[var]] %c = 1 | [[var]] %c = 1 | ||
Line 15: | Line 13: | ||
[[inc]] %c | [[inc]] %c | ||
} | } | ||
[[Echo|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 == | == See Also == | ||
Revision as of 22:13, 13 September 2005
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 can then be used in the calling routine.
Value is optional. If identifiers doesn't return any existing value, the return $null by default.
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
Contributed by Tovrleaf |