Skip to content
BENIBIX Learn

Syntax

Development🧩 Programming ConceptsPrograms

The rules for how code must be typed. One wrong sign and it will not run.

Think of it like

Think of it like the rules for writing a date. Day, month and year must go in the right spots.

Example

Jack types print("Hi" and forgets the last bracket. Python stops before running a single line.

Why it matters

Code that breaks the syntax rules never runs. Learning them is the first step in any new language.

Definition

Syntax is the set of spelling and grammar rules for a programming language. It says which words are allowed and where the brackets, quotes and commas go. Each language has its own syntax. The computer is strict about it, much stricter than a teacher. One missing bracket can stop the whole program from running.

Example code

python
>>> print("Hi"
  File "<stdin>", line 1
    print("Hi"
         ^
SyntaxError: '(' was never closed
One bracket is missing, so Python will not run the line at all.

Common mistake

Thinking correct syntax means correct code. A program can follow every rule and still do the wrong thing.

Key takeaways

  1. 1
    Strict rules. One wrong sign can stop the whole program.
  2. 2
    Per language. Each language spells things its own way.
  3. 3
    Form, not meaning. Good syntax does not mean the logic is right.

Learn it properly