Syntax vs. Semantics

Syntax? Semantics? What’s the difference? Let’s break it down.

Syntax

It’s the format we follow when we code in a particular programming language. Here are some examples:

Python

print(“Hello Gel”)

C

#include <stdio.h>
in…


This content originally appeared on DEV Community and was authored by Hexalore

Syntax? Semantics? What's the difference? Let's break it down.

Syntax

It's the format we follow when we code in a particular programming language. Here are some examples:

Python

print("Hello Gel")

C

#include <stdio.h> 
int main() { 
printf("Hello Gel"); 
return(0) 
}

Semantics

Semantics, on the other hand, is about the meaning or logic behind the code. It’s the formulation of how a program should behave. The logic can be expressed through:

  • Algorithms
  • Pseudocode
  • Flowcharts


This content originally appeared on DEV Community and was authored by Hexalore


Print Share Comment Cite Upload Translate Updates
APA

Hexalore | Sciencx (2024-10-17T02:58:56+00:00) Syntax vs. Semantics. Retrieved from https://www.scien.cx/2024/10/17/syntax-vs-semantics/

MLA
" » Syntax vs. Semantics." Hexalore | Sciencx - Thursday October 17, 2024, https://www.scien.cx/2024/10/17/syntax-vs-semantics/
HARVARD
Hexalore | Sciencx Thursday October 17, 2024 » Syntax vs. Semantics., viewed ,<https://www.scien.cx/2024/10/17/syntax-vs-semantics/>
VANCOUVER
Hexalore | Sciencx - » Syntax vs. Semantics. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/10/17/syntax-vs-semantics/
CHICAGO
" » Syntax vs. Semantics." Hexalore | Sciencx - Accessed . https://www.scien.cx/2024/10/17/syntax-vs-semantics/
IEEE
" » Syntax vs. Semantics." Hexalore | Sciencx [Online]. Available: https://www.scien.cx/2024/10/17/syntax-vs-semantics/. [Accessed: ]
rf:citation
» Syntax vs. Semantics | Hexalore | Sciencx | https://www.scien.cx/2024/10/17/syntax-vs-semantics/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.