Description
The process of determining the order in which statements execute in a program is called decision making. Describe the best usage for if, if else, and switch statements and specify their best usage.Provide an example of each to support your response.
Explanation & Answer
if else and switch statements are the control statements of a program which controls the instructional flow of the code. these instructions are bound to specific conditions.
for example if (x >1) {
}
else {
}
If statement "if" will be executed if x>1 and if that is not true, else part will be executed.
These types of instructions are useful for making decisions. for example deciding the greatest value of three variables or deciding lowest number of two values includes "if" "else" and switch statement. Switch is also if statement with a little changes syntax.
Review
Review
24/7 Homework Help
Stuck on a homework question? Our verified tutors can answer all questions, from basic math to advanced rocket science!