Northcentral Technical College Introduction To Programming
10-152-310
Introduction to Programming with JavaScript NTC 10-152-310

Learning Plan 5 Looping with a known loop count

# Looping with a known loop count

#### File: /Learning Plan 5/knownLoopCount.html

> Just do something 5 times.

### Loops With a Known Loop Count

- A very common looping task in programming is to loop a predetermined amount of times.
- We can code this with `while` loops or `for` loops. They are all equivalent in functionality. However, programmers tend to favor the `for` loop for this.
- Let's look at it with the `while` loop first then the `for`.
- Here's a small program that does something exactly 5 times.

- And here it is with a `for` loop.

- They look very similar. The main difference is that the `for` loop has one less line of code.

- The `while` loop does the same thing, only differently.

### Full Example

- Here's a full example: Fahrenheit-Celsius Conversion

### Labs!

> Not everything that can be counted counts, and not everything that counts can be counted. -Albert Einstein

- 5.1 Lab 7
  - 5.1 Assignment 1
- 5.1 Lab 8
  - 5.1assignment2