From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

Simple While Loop Counter Using LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit


  • LabVIEW

Code and Documents



This VI is an example of how you can implement a counter using a while loop.

The count value will either increase or decreases (based on selected enum control) its value each loop iteration. The count value will continue to increase or decreases unless the user resets the count, changes count direction, or stop the VI.


  • LabVIEW 2012 (or compatible)

Steps to Implement or Execute Code

  1. Download the example
  2. Open the example in LabVIEW
  3. Examine the block diagram
  4. Run the example VI


Additional Information or References
VI Block Diagram




**This document has been updated to meet the current required format for the NI Code Exchange.**


Matthew R.
Field Applications & Systems Engineer
National Instruments



Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.