goto
Prev | Orchestra Opcodes and Operators | Next

## goto

goto — Transfer control on every pass.

## Description

Transfer control to label on every pass. (Combination of igoto and kgoto)

## Syntax

    goto label

where label is in the same instrument block and is not an expression, and where R is one of the Relational operators (<, =, <=, ==, !=) (and = for convenience, see also under Conditional Values).

## Examples

Here is an example of the goto opcode. It uses the files goto.orc and goto.sco.

Example 172. Example of the goto opcode.

    /* goto.orc */
    ; Initialize the global variables.
    sr = 44100
    kr = 4410
    ksmps = 10
    nchnls = 1

    ; Instrument #1.
    instr 1
      a1 oscil 10000, 440, 1
      goto playit

      ; The goto will go to the playit label.
      ; It will skip any code in between like this comment.

    playit:
      out a1
    endin
    /* goto.orc */

    /* goto.sco */
    ; Table #1: a simple sine wave.
    f 1 0 32768 10 1

    ; Play Instrument #1 for one second.
    i 1 0 1
    e
    /* goto.sco */

## See Also

cggoto, cigoto, ckgoto, if, igoto, kgoto, tigoto, timout

## Credits

Example written by Kevin Conder.

Added a note by Jim Aikin.

Prev | Up | Next
gogobel | Home | grain