Important Notice:

if-else Statement

if-else Statement

20 views 1 min read

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

हिंदी व्याख्या: if-else में अगर condition सही है तो if वाला कोड चलेगा, गलत है तो else वाला कोड चलेगा।

English Explanation: In if-else, if the condition is true, if block runs; otherwise, else block runs.

Example:-

JavaScript
 
if (condition)
{ // अगर condition true हो }
else
{ // अगर condition false हो }
 
 

उदाहरण:

JavaScript
 

let age = 16;
if (age >= 18)
{
console.log("You can vote.");
}
else
{
console.log("You cannot vote yet.");
}
Output:-
You cannot vote yet.

 

 

Related Notes