Skip to content
  • Home
  • Account
  • Restricted content
  • OBEX
  • Chips Tips
  • Logout
  • Shop
  • Blog
Propeller OBEX
  • OBEX
  • Forum
Login
Propeller OBEX

Spin Language Reference

OBEX

  • Control your loops like a champ

Block Designators

View Categories
  • Home
  • Docs
  • OBEX
  • Control your loops like a champ

Control your loops like a champ

Reading Time: 1 min read

SPIN2

Introduction #

The Propeller 2 SPIN2 language has a new feature added in version 52 to extend the flexibility of the REPEAT loop control commands, NEXT and QUIT.

Explainer #

Within REPEAT constructs, NEXT and QUIT are two special instructions which can be used to change the course of execution. NEXT will immediately branch to the point in the REPEAT construct where the decision to loop again is made, while QUIT will exit the REPEAT construct and continue after it.

These instructions are usually used conditionally:

REPEAT
  {indented code}
  IF {condition}				- Optionally force the next iteration of the REPEAT
    NEXT
  {indented code}
  IF {condition}				- Optionally quit the REPEAT
    QUIT
  {indented code}

NEXT and QUIT can each be followed by an integer value 1..16 to alter the nesting level at which they are to occur.

If no integer value is expressed, the default value of 1 is used, which means the current nesting level. The value 2 would mean the outer nesting level, while three would mean the next outer nesting level, and so on.

Nested Example #

REPEAT
  {outer loop code}
  REPEAT 5
    {indented code}
    IF {condition}				- Optionally force the next iteration of the REPEAT
      NEXT
    {indented code}
    IF {condition}				- Optionally quit the OUTER REPEAT loop, 2 nested levels up
      QUIT 2
    {indented code}

Resources #

Parallax Propeller 2 - Spin2 Language Documentation


Was this useful ?

Share This Article :

  • Facebook
  • X
  • LinkedIn
Still stuck? How can we help?

Still stuck? How can we help?

Updated on October 10, 2025
Table of Contents
  • Introduction
  • Explainer
  • Nested Example
  • Resources

Copyright © 2025 - Parallax Inc.
599 Menlo Drive | Rocklin, CA 95765 | USA