How to Write Loops in VB.NET

Loops are a common programming technique. Most applications are made up primarily of loops. These are sentences in your code that tell the program what to look for and what to do. Writing loops in VB.NET is a matter of understanding what you need from the program and what type of loop works best.

Instructions

    • 1

      Learn the various types of loop. A "Do ...While" loop tells the program that it is to perform a task while a particular condition is true. Each loop has its own purpose and a firm understanding of the differences is necessary.

    • 2

      Understand what you need the program to do. Writing a program is a logic exercise. Know exactly what you need the program to perform, whether it is adding a single digit or calculating a complex formula.

    • 3

      Write out the steps. Using pseudo-code will help with the computer code. Write down step-by-step what you need the computer program to do, leaving out nothing in the steps.

    • 4

      Convert pseudo-code to VB.NET. Use the handwritten code, which should resemble the way a human thinks and write out what the VB.NET coding would be for each step.

    • 5

      Use your steps to do the work yourself. Plug in a number for the variables you have. Work through the problem using your code to determine if you arrive at the correct answer. With simple loops, it's easy to work out a problem on your own.

    • 6

      Prepare to debug. Most applications will have some problems and loops are a primary cause. Prepare to work through any problems to correct your loops.

Related Searches:

Comments

You May Also Like

Related Ads

Featured