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

Propeller 1

  • Tilde manipulation of the DIRA and OUTA registers
  • How to pause in PASM
  • How to choose between VAR and DAT
  • WAITPEQ and WAITPNE with PASM
  • IO pin manipulation using PASM
  • Control IO pins from any cog
  • 3D Models for Parallax Products
  • Implementing Abstract Data Structures with Spin Objects
  • Making in USA - The Parallax 8 core microcontroller
  • Simultaneous pin group control
  • Programming the FLiP module over WiFi
  • Keep any value in range
  • Handy Diagnostic Heartbeat
  • Customer Code Deployment in one click

Propeller 2

  • Control your loops like a champ
  • Generate a clock with any SmartPin
  • Floating point operators in SPIN2
  • 64/96/128-Bit Unsigned Integer Math
  • 3D Models for Parallax Products
  • DEBUG Plot Layer and Crop
  • Floating point
  • Getting Started Video Tutorials
  • Using the counter for timeouts
  • asmclk and the automatic clock setter
  • Sharing variables between SPIN2 and PASM2
  • Keep any value in range
  • Determine pin state - High, Low or Floating?
View Categories
  • Home
  • Docs
  • Chips Tips
  • 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