How to Program - What is Syntax Anyway?

Syntax is defined by Dictionary.com as:

Computers. the grammatical rules and structural patterns governing the ordered use of appropriate words and symbols for issuing commands, writing code, etc., in a particular software application or programming language

What that really means is that syntax is the rules of a programming language. Many languages have both very similar rules and very different rules at the same time. It is very important that when learning a new language you pay attention to syntax, as that is where many mistakes happen. It is also important to note that syntax is there for a reason, it helps the computer understand your code without having to guess anything. For instance parts of syntax will define the end of a statement in a programming language, or it can define a section of code that should all be executed together under certain conditions. Normally syntax only applies to formatting and does not determine functionality of code, but there are rare occasions that syntax and functionality blend.

In this portion we will look at the syntax of three very different languages: HTML, CSS and JavaScript. You are not expected to memorize the syntax of each, rather we will be looking at general syntax rules of each language and get to specifics when we actually start using them. We will start with HTML first then we will move on to CSS and finally we will look at JavaScript. The reason I am introducing the languages in this order is because most professionals would create a website in this order as well. Also, this order shows how to cleanly seperate all of the different pieces of a program into different parts for better maintenance. These parts are Presentation, Problem Domain Logic, and Data Manipulation.

Valid HTML 5 Valid CSS! Creative Commons License
This work is licensed under a Creative Commons License.
Privacy Policy