Question: what is the difference between syntax and semantics in computer programming?
Answer: Semantics follow directly from syntax. Syntax refers to the structure/form of the code that a specific programming language specifies but Semantics deal with the meaning assigned to the symbols, characters and words. You need correct syntax to compile. You need correct semantics to make it work.