Advertisements
Advertisements
Question
Write the syntax for else-if statement.
Advertisements
Solution
Syntax:
if (expression1)
{
Execute code block #1
}
else if (expression2)
{
Execute code block #2
}
else if (expression3)
{
Execute code block #3
}
else
{
If all else fails, execute block #4
}APPEARS IN
RELATED QUESTIONS
Which conditional statement is used to transfer control from current statement to another statement?
Which statement in switch case is used to exit the statement once the appropriate choice is found?
The _______ statement is especially useful when testing all the possible results of an expression.
<script type=“text/javascript”>
x = 6 + “3”;
document.write(x);
</script>
what will be the output?
What are the different types of control statement used in JavaScript?
What is if statement and write its types.
What message will be displayed, if the input for age is given as 20, for the following snippet?
The absence of which statement leads to fall through situation in switch case statement?
Consider the following program segment and select the output of the same when n = 10:
switch(n)
{Case 10: System.out.println(0*2);
case 4: System.out.println(n*4); break;
default : Syslem.out.println(n);
}Which of the following is not true with regards to a switch statement?
