answersLogoWhite

0

What does an IF Statement do?

User Avatar

Anonymous

8y ago
Updated: 8/20/2019

An if statement is a control statement. It is used to control whether a statement executes or not, depending on whether a control expression evaluates true or false.

if (expression) {

statement;

}

In the above example, the expression is evaluated. If true, the statement executes, otherwise it does not.

if (expression) {

statement1;

} else {

statement2;

}

In the above example, the expression is evaluated. If true, statement1 executes otherwise statement2 executes.

Note that if statements may be chained together using else if statements. The final else clause (if present) then becomes the default case. Also, any statement within an if statement may itself be an if statement, known as a nested if. If statements may be chained or nested to any depth.

User Avatar

Wiki User

8y ago

What else can I help you with?

Related Questions

What is a contradiction of a statement?

A contradiction of a statement is a statement that proves the previous statement wrong.


What is singular possessive of statement?

The possessive form for the singular noun statement is statement's.


What should a businesses financial statement contain?

it should contain statement of comprehesive statement, statement of financial position and statement of cashflows


Reverse and negation of an if-then statement?

The reverse and negation of an if-then statement is as follows:if (...) then statement;reversed becomesif (not (...)) then statement;


Is 2 plus 4 equals 13 a statement?

It is a statement. It is a false statement, but a statement nevertheless.


Is income statement same as financial statement?

no. income statement is a only a statement in financial statements.


Is the Bank Reconciliation statement a part of financial statement?

Bank reconciliation statement is not part of financial statement it is the helping statement to tally bank account with balance in banks statement.


is this statement true or false BC?

If the statement is false, then "This statement is false", is a lie, making it "This statement is true." The statement is now true. But if the statement is true, then "This statement is false" is true, making the statement false. But if the statement is false, then "This statement is false", is a lie, making it "This statement is true." The statement is now true. But if the statement is true, then... It's one of the biggest paradoxes ever, just like saying, "I'm lying right now."


What order are financial statement prepared?

Income Statement, Retained Earnings Statement, Statement of Equity, Balance Sheet, and then Statement of Cash Flows.


What is the deffernce of the switch statement and the if statement in c plus plus?

If statement is single selection statement,whereas the switch statement is multiple selective.


What is the difference between a declarative statement and an imperative statement?

In a declarative statement, you initialize the object. But in an imperative statement, you use a preexisting statement and use it.


What is statement of scale?

A statement scale is a scale that makes a statement!! :) ;) :(