Table of Contents

goto

Description

Transfer script execution to the specified script line.

Note line numbers start at 0.

Function prototype

void goto <int:line>

Arguments

Name Type Comment
line int The zero-based line number to which execution should be transferred.

Return value

None (void).

Example

goto 3 // jump to line #3
echo "1"
echo "2"
echo "3" // goto should jump to this line
echo "4"

… the output of which is written to the event log by echo as:

3
4

Comments

See Go To Statement Considered Harmful.

See also