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 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.


What is the difference between bar scale and statement scale?

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


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 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.


What is the difference gwbasic commands and statements?

difference between command and statement


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.

Trending Questions
How many ounces are equal to 4 pounds and 10 ounces? Where can someone buy an MSY computer? Why is it important to return document to the designated location on completion of the work actvities? WHAT must collection managers continuously monitor the results of? When did Computer Usage Company end? Which is considered a direct entry input device? What does excel do when you enter a value into a cell? What we enter into the computer? I deleted songs in iTunes library and they went to recycling but they weren't deleted on iPod so I restored the songs so I could delete them on iPod but I can't find the songs in iTunes where are they? What is the difference between a quick link and a hyperlink? How do you delete apps or books off a Kindle Fire? How much milliliters is 8 liters? What are the key features of an online scheduling and appointment booking software? How can you convince your parents to buy you a Mac Computer please don't tell me to buy it myself cause I'm only 13 and i can't get a job I would like to know how to get my parents to buy me a mac? When is the new iMacs coming out and when? Nvidia geforce 6200 256mb ddr agp free driver download? How do you change from capital letter to small letter on PAGES on a MAC? Which is the best first step to protect important data on your hard drive? How do you place an unzipped file on a usb flashdrive? How do you solve a problem where double clicking on local C drive produces a message asking to choose a program to open it?