Goto » History » Version 1
Per Amundsen, 02/10/2014 10:16 PM
1 | 1 | Per Amundsen | */goto <label>* |
---|---|---|---|
2 | |||
3 | Allows you to jump from one point in a script to another point. |
||
4 | |||
5 | *Parameters* |
||
6 | |||
7 | <label> - The label to jump to. |
||
8 | |||
9 | *Example* |
||
10 | |||
11 | <pre> |
||
12 | ; /is_even <1-9> |
||
13 | ; |
||
14 | ; Example: /is_even 2 |
||
15 | ; 2 is an even number. |
||
16 | ; 2 is a prime number. |
||
17 | alias is_even { |
||
18 | /goto $1 |
||
19 | :0 | echo -a You typed zero. | return |
||
20 | :4 | echo -a $1 is an even number. |
||
21 | :1 | :9 | echo -a $1 is a perfect square. | return |
||
22 | :2 | echo -a $1 is an even number. |
||
23 | :3 | :5 | :7 | echo -a $1 is a prime number. | return |
||
24 | :6 | :8 | echo -a $1 is an even number. | return |
||
25 | :error |
||
26 | /echo -a Only single-digit numbers are allowed! |
||
27 | /reseterror |
||
28 | } |
||
29 | </pre> |