answersLogoWhite

0

Nested if else construct

User Avatar

Anonymous

14y ago
Updated: 8/18/2019

Perfectly legal and usable.

User Avatar

Wiki User

14y ago

What else can I help you with?

Related Questions

What is a nested if then else pattern?

if any 'if' contains another if within its body and 'else' contains another else within its body then this is known as nested if or else.


Can a if-then-else structure be nested?

Yes.


Syntax of nested if in c?

If(condition) { if-else statement; } else { if-else statement; }


What is nesting in C programming?

Nesting can be a very handy tool in C++, but should be avoided if possible.C++ gives us If statements, For loops and many other things. These can be nested. For example:A nested If statement://outer if statementIf( this is true ){//nested if statementif( this is also true ){//do something}else{//do something else}}


What is nested if then else patterns?

Many if..then..else statements in one. eg from Java if (this_is_true) { if (this_is_also_true) {//do this } else { //first statement was true, second was false } } else { //Nothing was true }


What is an 'embedded if' statement?

nested if statements. Example: If condition is right then if condition is even better then ... else ... end if else if condition is worse then ... else ... end if end if


What are the disadvantages of nested if in C?

Nothing, but be careful with the dangling else's: if (cond1) if (cond2) stmt1; else stmt2; means: if (cond1) { if (cond2) stmt1; else stmt2; } not this: if (cond1) { if (cond2) stmt1; } else stmt2;


Would you be correct in saying that in an nested if statement it would read ----if and it is and it is then do this--- else do this?

What you are asking would be not be a nested if then else statement, in pseudocode what you are asking would be:if condition thendo thiselsedo that[this is pseudo code because the 'and' would be rendered differently in other languages and there potentially would be statement terminators, etc]A nested if statement would be:if condition1 thenif condition2 thendo thiselsedo thiselsedo thatThe second if statement is nested within the first one, clearly the nesting can go on quite deeply.


What is nested logic?

In Nested Logic a Logic is contained within a Logic. If the Outer Logic is TRUE then the internal Logic is executed. Nested IF, Nested For, Nested While, e.t.c are some examples of Nested Logic in Modern Computer Languages.


When was Nested created?

Nested was created in 1977.


How long did it take to construct Alcatraz island?

ask someone else


In which of the following scenarios would you need to use a nested IF statement?

You use a nested if when the condition is dependent upon another condition. For example: if (ptr != nullptr) { // ptr is non-null -- test the value it refers to if (ptr* == 0) { // the value pointed to by ptr is zero } else { // the value pointed to by ptr is non-zero } } In this case, the alternative to a nested if creates an inefficiency: if (ptr != nullptr && *ptr == 0 ) { // ptr is valid and refers to the value zero } else if (ptr != nullptr) { // ptr is valid and refers to a non-zero value } In this example, the expression "ptr != nullptr" is evaluated twice when ptr is valid and refers to a non-zero value. The nested if only evaluates this expression one time.