Difference between revisions of "Goto"

From Hercules Wiki
Jump to: navigation, search
(Created page with "== Syntax == * goto <label>; == Description == This command will make the script execution jump to the specified label. It is often used by beginners in conjunction with ...")
 

Latest revision as of 00:01, 23 June 2013

Syntax

  • goto <label>;

Description

This command will make the script execution jump to the specified label. It is often used by beginners in conjunction with if, before they get accustomed to other conditional statements, such as for or switch. While advanced scripters typically discourage using goto, it can come handy when requiring to leave a complex nested loop without having to use flags or even more complicated code.

Examples

if (checkriding()) goto L_riding;
	mes "Yay, you're not riding a Peco.";
	close;

L_riding:
	mes "Please dismount your Peco first.";
	close;