Symbol Goto: Difference between revisions

From NARS2000
Jump to navigationJump to search
Line 25: Line 25:
[1] 'This is one'<br/>
[1] 'This is one'<br/>
[2] two<br/>
[2] two<br/>
[3] 'return to one from two'<br/>
[3] 'return to one from two'
:{delta}<br/>
:{delta}


:{delta}two<br/>
:{delta}two
[0] two<br/>
[0] two<br/>
[1] 'This is two'<br/>
[1] 'This is two'<br/>
[2] {goto}0<br/>
[2] {goto}0<br/>
[3] 'Two Continues'<br/>
[3] 'Two Continues'
:{delta}
:{delta}


:one
:one
This is one
This is one<br/>
This is two
This is two<br/>
return to one from two
return to one from two
     
</tt>
</tt>


{{Article footer}}
{{Article footer}}
{{Symbol footer|1|G}}
{{Symbol footer|1|G}}

Revision as of 15:41, 26 November 2014

→ — Branch to a line in a function — Keystroke ALT+] — Character 8594 or 0x2192

APLKB-Goto.png

Alternate Names

This symbol is also known as right arrow or APL text symbol {rightarrow}.

Usage

The goto symbol may be used as a conditional branch (branch based on a comparison) or an unconditional branch, or it may be used to exit a function. It is most often used in a function to transfer control, but can be used from the session manager to transfer to a line in a suspended function.

Conditional branch

Unconditional branch

The goto symbol is followed on the right either by the line number or a label. Execution continues in the function at that line (unless the line specified is 0, in which case the function exits.)

Exit Function

The goto symbol may be used to exit a function and return to the calling function (or return to the session manager if the function was called by the user typing its name) by using 0 as the line number to goto.

Example

Exit Function

In the following example, function one calls function two, which exits part way through the function, returning to function 1.

∆one

[0] one
[1] 'This is one'
[2] two
[3] 'return to one from two'

∆two

[0] two
[1] 'This is two'
[2] →0
[3] 'Two Continues'

one

This is one
This is two
return to one from two


See Also
System Commands System Variables and Functions Operators


Keyboard
A+S
Alt ¨ ¯ < > × ÷
Sh ~ ! @ # $ % ^ & * ( ) _ +
Key ` 1 2 3 4 5 6 7 8 9 0 - =
A+S
Alt ? § π
Sh Q W E R T Y U I O P { } |
Key q w e r t y u i o p [ ] \
A+S
Alt
Sh A S D F G H J K L : "
Key a s d f g h j k l ; '
A+S χ
Alt
Sh Z X C V B N M < > ?
Key z x c v b n m , . /
NARS 2000 Lang
Tool
Bar
+ - × ÷ * ! ? |
< = >
~ § π .. ,
/ \ ¨ .
_ ¯
Second Row i j k i j k l g p r v x

[[Category:Mouse Group {{{1}}}|{{{2}}}]]