until
Prev | Orchestra Opcodes and Operators | Next

## until

until — A syntactic looping construction.

## Description

A syntactic looping construction.

## Syntax

    until  condition do
        ... od

## Performance

The statements between the do and od form the body of a loop which is obeyed until the conditional becomes true.

## Examples

Here is an example of the until construction. It uses the file until.csd.

Example 1090. Example of the until opcode.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

    <CsoundSynthesizer>
    <CsOptions>
    ; Select audio/midi flags here according to platform
    ; Audio out   Audio in
    -odac           -iadc    ;;;RT audio I/O
    ; For Non-realtime ouput leave only the line below:
    ; -o ifthen.wav -W ;;; for file output any platform
    </CsOptions>
    <CsInstruments>

    sr = 44100
    kr = 4410
    ksmps = 10
    nchnls = 1

    instr 1
    lab99:
    if p4<0 goto lab100
      p4 = p4-1
      print p4
      goto lab99
    lab100:
    endin

    instr 2
      until p4<0 do
        p4 = p4-1
        print p4
      od
    endin
    </CsInstruments>
    <CsScore>
    i 1 1 1 4
    i 2 2 1 4
    e

    </CsScore>
    </CsoundSynthesizer>

Its output should include lines like this:

    B  0.000 ..  1.000 T  1.000 TT  1.000 M:      0.0
    new alloc for instr 1:
    instr 1:  p4 = 3.000
    instr 1:  p4 = 2.000
    instr 1:  p4 = 1.000
    instr 1:  p4 = 0.000
    instr 1:  p4 = -1.000
    B  1.000 ..  2.000 T  2.000 TT  2.000 M:      0.0
    new alloc for instr 2:
    instr 2:  p4 = 3.000
    instr 2:  p4 = 2.000
    instr 2:  p4 = 1.000
    instr 2:  p4 = 0.000
    instr 2:  p4 = -1.000
    B  2.000 ..  3.000 T  3.000 TT  3.000 M:      0.0

## See Also

loop_ge, loop_gt and loop_le. loop_lt. while.

## Credits

John ffitch.

New in Csound version 5.14 with new parser

Prev | Up | Next
unirand | Home | unwrap