0% found this document useful (0 votes)
2 views

ERROR CHECKING

Uploaded by

Nelly Chantal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

ERROR CHECKING

Uploaded by

Nelly Chantal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 6

ERROR CHECKING

What is Syntax error?


This is a mistake within a program that causes the program to stop running.
The errors are usually caused by a programmer
Examples of programming errors
 Spelling the name of the function incorrectly such as primt instead
of print
 Using an incorrect character , such as squire bracket instead of a
round brackets
 Incorrect formatting of a function such as using upper case instead
of lower case
 Incorrect sequencing of a function, such as else before if
 Inserting an invalid character, such as # symbol into a line.
TIPS FOR LOCATING AND FIXING SYNTAX ERRORS
 Start by identifying spelling mistakes.
 Check the case you have used. If upper-case or lower-case depending
on a programming language.
 Check the characters and symbols such as brackets, single or double
quotation marks and hash for comments.
 If possible, print out your code. Go through line by line
Example of syntax error in python
The following program code contains 5 syntax errors
#Area of a triangle
Height=int(input(“Please enter the height of a triangle:”)(
Base=int(imput(“Please enter the base of a triangle:”))
Area=(height*base)\2
Prrint(“The area of a triangle is”,Area)
Correct version of the code when errors corrected
The following program code contains 5 syntax errors
#Area of a triangle
Height=int(input(“Please enter the height of a triangle:”))
Base=int(input(“Please enter the base of a triangle:”))
Area=(height*base)/2
Print(“The area of a triangle is", area)

You might also like