Types of errors in programming
If you started programming first thing you notice is that things brake and they don't alway work as you expected. Even when they work, you might see that the output is wrong and there is a logic fault somewhere in the code. It might be useful to know that there are 4 types (maybe even more) types of errors a program can have.
1. Syntax errors
This happens when the code doesn't respect the syntax rules a program requires. For example, in C# or Java if you omit the semicolon at the end of the line, that will confuse the compiler because it will not know that you mean anymore so as a result will throw an error.
Logical errors
As the name implies, these appear when the program runs but behaves not as expected or gives wrong results. To give a trivial example, you might right a program that compares two numbers and at some point when you run it it might say 5 > 2. This is clearly not true and probably not intented so there might be something wrong in the way the algorithm or the intructions were writen.
Runtime errors
Runetime errors are those errors that apear unexpectedly while the program is running. The program or the compiler doesn't know about them until they happen. One commen example is to try to access a variable that doesn't exist like if you have an array with three values ['a', 'b', 'c'], trying to access array[3] will obviously fail because the index 3 is out of bounds (is beyond the length of the array). array[0], array[1], array[2] will work. Another quick example is division by 0 which is not possible.
Latent errors
Latent Errors are the ‘hidden’ errors that occur only when a
particular set of data is used. This is usually when the programmer forgot to deal with certain edge cases. For example you might have an input for card number but you didn't consider the case when the user accidentally types letters.