answersLogoWhite

0

An if-then statement, or simply an if statement, checks if a stated condition is true. If the condition is true, then a block of code will then execute.

Example:

if number equals 3

print out "Number equals 3"

An if-then-else statement, or simply an if-else statement, checks if a stated condition is true. If the condition is true, then a certain block of code will then execute. If the condition is false, then a different block of code will then execute.

Example:

if number equals 3

print out "Number equals 3"

else

print out "Number does not equal 3"

For both if statements and if-else statements, there is only one stated condition. The difference between them is that an if statement will only cause something to happen if the condition is true. An if-else statement will execute a block of code whether the condition is true or false.

User Avatar

Wiki User

7y ago

What else can I help you with?

Related Questions

What is the difference between if-else and else-if?

if-else implies a first statement, while else-if implies that we would know what else is but we don't because else is defined by if.


What is difference between basic command and statement?

difference between command and statement


What is the difference between bar scale and statement scale?

What is the difference between a bar scale and a statement scale


What is the difference between hypothesis and inference?

A hypothesis is a statement of fact or belief upon which further conclusions can be drawn. An inference is the meaning that I attribute to someone else's statement or action.


Difference between if else and else if?

what is diffrence between if else and else if


What is the Difference between program and flowchart?

Flowchart it is diagrammatic Program it is coding. A flowchart is drawn out on paper, and shows the logic of an if/then/else statement. The programming actually is the if/then/else, not just the logic.


What are the difference between command and statement?

i am starving


What is the difference gwbasic commands and statements?

difference between command and statement


What is the difference between ternary operators and if-else statement?

ternary is a single statement operator while even the most primary form of if else contains an if and an else statement. ternary only returns a value but if else can be used to do a lot of other things like printing, assigning values or just returning true or false.


Difference between scope statement and project charter?

The difference between a scope statement and a project charter is that a project charter acknowledges the projects existence and the scope statement defines the project objectives.


What is the difference between 'switch' statement and 'if' statement?

we can use switch statement in multiple time but in if statement we can not use multiple time


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.