मराठी
तामिळनाडू बोर्ड ऑफ सेकेंडरी एज्युकेशनएचएससी विज्ञान इयत्ता १२

Explain the if elseif else statement. With suitable example.

Advertisements
Advertisements

प्रश्न

Explain the if elseif else statement. With suitable example.

थोडक्यात उत्तर
Advertisements

उत्तर

  1. If-elseif-else statement is a combination of if-else statement.
  2. More than one statement can execute the condition based on user needs.

Syntax:

if (1st condition)
{
Execute statement(s) if condition is true;
}
elseif(2nd condition)
{
Execute statement(s) if 2ndcondition is true;
}
else
{
Execute statement(s) if both conditions are false;
}

Example Program:

<?php
$Pass_Mark=35;
$first_class=60;
$Student_Mark=70;
if ($Student_Mark>= $first_class){ echo “The Student is eligible for the promotion with First Class”;
}
elseif ($Student_Mark>= $Pass_Mark){ echo “The Student is eligible for the promotion”;
}
else {
echo “The Student is not eligible for the promotion”;
}?>
shaalaa.com
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
पाठ 6: PHP Conditional Statements - Evaluation - PART – IV [पृष्ठ १११]

APPEARS IN

सामाचीर कलवी Computer Applications [English] Class 12 TN Board
पाठ 6 PHP Conditional Statements
Evaluation - PART – IV | Q 4. | पृष्ठ १११
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×