Important Notice:

if Statement

if Statement

22 views 1 min read

The if Statement (if स्टेटमेंट)

हिंदी व्याख्या: if स्टेटमेंट तब इस्तेमाल होता है जब हमें किसी शर्त को चेक करके काम करना हो। अगर शर्त सही (true) हुई तो कोड ब्लॉक अंदर चलेगा।

Syntax:-
 
if (condition) { // कोड यहां चलेगा अगर condition true हो }

उदाहरण:


 let age = 20;

if (age >= 18) {
console.log("You are eligible to vote.");
}

Output:-
 You are eligible to vote.

English Explanation:

The if statement is used when we want to execute a block of code only if a condition is true.

JavaScript
 
if (condition) { // Code runs if condition is true }

Example:

JavaScript
 
let age = 20;

if (age >= 18) {
console.log("You are eligible to vote.");
}

 

Related Notes