O-code Repeat

The O-code repeat is a flow-control instruction for NC programs. It executes the statements between a matching repeat and endrepeat a specified number of times. The same O-number labels both the repeat and endrepeat lines.

Source checked3/3 values · 2026-10-26

Specification

1 source
Languagegcode
Coderepeat
Groupflow control
Syntaxo103 repeat [5] ... o103 endrepeat
Dialectrs274ngc

Study notes

  • O-codes use the letter O, not the digit zero, as the first character, such as O100 or o100.
  • The repeat count is shown in square brackets in the example o103 repeat [5].
  • The example uses repeat/endrepeat to mill 5 diagonal shapes starting at the present position.
  • The repeat and endrepeat lines share the same O-number label.
  • A label on endrepeat that does not refer to a corresponding repeat causes an error message and aborts the interpreter.
↑↓ navigate↵ openesc close