answersLogoWhite

0

They do the same thing, but only the former can be used in a Java program.

User Avatar

Wiki User

14y ago

What else can I help you with?

Continue Learning about Engineering

If then else statements and case statements essentially perform the same function when would you use one over the other?

I would recommend an If - then - else statement over a switch statement because:1. It is simpler/easier2. You do not get unexpected output because of missing break statementsA missed break statement in one of the conditions in a switch case statement means that all the conditions that come after the success condition are executed. In case of if else this is not the case and hence it is much safer for novice programmers.> essentially perform the same functionNo, they don't. Here is an example to prove this:if (sin (alpha) > cos (alpha)) {...} else if (alpha / M_PI * 180 > 180) {...} else {...}


What is advantage of capacitor filter over RC filter?

sounds same to me.maybe you meant advantage of LC filter over RC filter


Why goto in c is a bad command?

A 'goto' statement immediately moves the execution of code to another part of the program. This makes the code difficult to follow and to debug. It is better practice to use If-then-else constructs to structure the program code.


Major advantage in cpp compared to c?

The major advantage of C++ over C is the Object Oriented Programming compatibility in C++.


Advantage and disadvantage of for loop over while looop?

Any for loop is equivalent to some while loop, so the language doesn't get any additional power by having the for statement. For certain type of problem, a for loop can be easier to construct and easier to read than the corresponding while loop. The for statement makes a common type of while loop easier to write. It is a very good (perhaps the best) choice for counting loops.

Related Questions

What advantage would tools have over the previous kinds of tools?

they would not break


What advantage does the current definiton of the meter have over the 1793 statement?

I have no idea! Answer it yourself you bafoon!Go to googleType your questionbe all girly happy


Javas major disadvantage over c and c plus plus?

In C it's easier to work with hardware directly. Also C programs are usually more efficient.


What are examples of advantage?

A very practical example of mechanical advantage is the use of a "cheater bar." If you find a bolt that is hard to break, simply slip a long pipe or similar object over the handle and it will apply much more torque.


What is the advantage of using a steel rule over wooden?

Anyone who is wondering the advantage of using a steel rule over a wooden one they would quickly find that the steel rule is much more durable and easy to read. The wooden rule is quite prone to break if accidentally used wrong.


What advantage do citizen journalists have over professional journalists?

Citizen journalists are already at the scene of a breaking news event


The main advantage of ECL over TTL?

The main advantage of ECL over TTL is speed.


What advantage does standard form have over scientific notation?

It has no advantage.


What type of Pokemon dose ice pokemon has an advantage over?

They have an Advantage over Dragon,Grass,Flying and Ground.


What was the advantage the conquerers of Egypt had over the Egyptians?

hun.... it was there weapons that was there advantage over the Egyptans the worked with several weapons


What is an advantage?

An advantage is something which assists one person over another in a given situation.


A statement that can be written in if-then form. conditional statement?

Rise over run raio