-*- Mode: Text; Fonts: Ct18b -*- 2.3 ERRORS An Ada program may be incorrect for various reasons. Three categories are recognized according to how they are detected. Some errors wil be detected by the compiler - these will include simple punctuation mistakes such as leaving out a semicolon or attempting to violate the type rules such as mixing up colours and fish. In these cases the program will not be executed. Other errors are detected when the program is executed. An attempt to find the square root of a negative number or divide by zero are examples of such errors. In these cases an exception is raised as we saw in the last section and we have an opportunity to recover from the situation. Finally there are certain situations where the program breaks the language rules but there is no simple way in which this violation can be detected. For example a program should not depend on the order in which parameters of a procedure call are evaluated. If it does then the behaviour may depend upon the implementation. Such a program is said to be erroneous. Care must be taken to avoid writing erroneous programs; in practice if we avoid clever tricks then all will be well.