When does shortcircuit evaluation affect expressions or Wh
Solution
2)
Short circuit evaluation expressions
Lets consider a condition
false && ____
Here in this condition if the left hand side is false then it won’t check whether the right hand side true or false .As the final result is false.
When coming to the ||
True || _____
Here it is not necessary to check the right hand side if the left hand side is already true.As the final result is true.
_________________________
3)
If we want to check whether the number is in the range of values then we have to use this condition as an expression in case of if-else ladder
We can’t write this type of expression in case of switch statement.
In case of switch statement ,we can use only single expression for multiple choices.
____________________________
4)
In case of if-else –if statements.The control starts checking the conditions.If the condition of the first statement is executed and if the condition is true then the remaining condition statements will not get executed.The control will check the next condition in the if – else ladder only if the previous condition is false.Like this each and every condition it will check in that ladder until the condition is true
__________________________
5)
If we want to execute a particular task.If the task involves multiple statements then we have to use.Then we have to place all those multiple statements in a single block of code by placing it in curly braces {}.
_________________________
6)
//count from 1 to 10
For(int i=1;i<=10;i++)
{
}
//count from 10 to 1
For(int i=10;i>0;i--)
{
}
//counting from zero to 10 by 2’s
For(int i=0;i<=10;i+=2)
{
}
//counting from 10 to zero by 2’s
For(int i=10;i>=0;i-=2)
{
}
___________________________


