Syntax

What is syntax?

Syntax of a programming language is the set of rules for how to write instructions in that language. Syntax is like the grammar for that language. The syntax rules tell you how to respond to particular conditions, store data, and control the flow of execution in the language.

What is a syntax error?

A syntax error happens when a program doesn't follow the syntax rules. The language won't understand how to execute the code, even if only a minor mistake is made, like a missing comma or parenthesis.

What is a logical error?

A logical error happens when your program follows the syntax rules and runs, but doesn't do what you want it to do. You'll know you have a logical error when your project generates output but the output doesn't match the project spec. You'll need to reevaluate your approach to the problem and then modify that approach.