369 TESLAKALVIYOGI
Page 22 of 30

If Statement in 4 Languages

Basic if syntax comparison

</> logic
1

Concept Meaning

All four languages use if to check a condition, but braces, semicolons, and indentation change.

2

Real-Life Analogy

Same classroom rule written on four different notice boards.

3

Expected Output

Pass if mark is 35 or more.
4

Common Mistake

Python needs colon and indentation. JS/C++/PHP commonly use braces.

Same Logic • Different Syntax

Code in 4 Languages

JavaScript
if(mark>=35){
  console.log("Pass");
}
C++
if(mark>=35){
  cout<<"Pass";
}
Python
if mark>=35:
    print("Pass")
PHP
<?php
if($mark>=35){
  echo "Pass";
}
?>

Memory Tip

Meaning same. Syntax changes.