In this, unit we learn how to debug the two common types of programming errors, and gain knowledge on looping.
Types of Programming Errors
Being very, very careful in creating a program, errors do occur.
Knowing the types of errors would help you in correcting the errors.
The two major types of errors are:
1. Sytanx
- is the most common type of error
- created by not following the "sytanx" of the language
- often casued by a keyborading error
2. Logic
-a problem created by the organization (sequence) of the program
-often difficult to detect becasue the program may often "work" but it produces incorrect results
Looping, is the repedition of a set of instructions. The instructions that are repeated are called the body of the loop.
The format, well "x" represents the loop control variable - it is used to count the number of times the body if the loop is replaced "number" is repeated with valie for the number of times the body of the loop is to be repeated
"++x" - each time the loop id completed, the number 1 is added to x
Click here to see an examples of JavaScript in action: