369 TESLAKALVIYOGI
Page 4 of 30

Program Structure

Basic structure of JS, C++, Python, PHP program

</> logic
1

Concept Meaning

Every program has a structure: write instructions, run them, and show output. Some languages need extra structure, while others are direct.

2

Real-Life Analogy

A school assembly has a fixed order: prayer, news, thought, announcement. A program also follows an order.

3

Expected Output

Program runs in order.
4

Common Mistake

Do not ignore braces, semicolons, indentation, or opening tags.

Same Logic • Different Syntax

Code in 4 Languages

JavaScript
let msg="Hi";
console.log(msg);
C++
#include <iostream>
using namespace std;
int main(){
 string msg="Hi";
 cout<<msg;
 return 0;
}
Python
msg="Hi"
print(msg)
PHP
<?php
$msg="Hi";
echo $msg;
?>

Memory Tip

Structure makes code readable.