answersLogoWhite

0


Best Answer

Nothing special, eg:

switch (c) {

case 'A':

/* use any 'logic' you want */

break;

default:

/* use any 'logic' you want */

}

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you use logic inside switch statement?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Why you use for loop inside switch statement?

Because you have to repeat something. (Or you can use while-loop, too.)


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


Can a continue statement be used in a switch statement?

If you have a loop in your switch statement or around your switch statement, you can use the continue statement in that. You cannot use a continue statement outside of a loop (do, for, or while).


What is a logic argument?

A logic argument is a statement of logic. The term "argument" means a statement that could be true or false. A Statement that has not been tested as true or false is known as a theory. Logic is the term meaning the structure of an argument or statement and how it applies in its use.


What programming languages use a C switch statement?

There are two programming languages which use a C switch statement. The two languages are C and C++, hence the name C switch statement. There may be more, but those are the most obvious ones


What can you use to explain the statement in the geometric proof?

Yo could try using logic.


What is the use of switch statement in java?

In java, a switch statement is used to simplify a long list of 'if' statements. A switch statement takes the form of:switch (variableName){case condition1; command1;case condition2; command2;...}


In command prompt what does the if switch do?

There is not switch called "if". We generally use "if" statement in batch programming in DOS.


How do you choose multiple if statement and switch statement?

If you must evaluate two or more expressions separately, use multiple if statements. If you only need to test all the possible evaluations of a single expression, use a switch.


What is the similarity between 'if' statement ans 'switch' statement?

A Switch statement can be considered as a series of if. else if. else statements. whatever condition is satisfied, the code block would get executed. if (cond 1) { } else if (cond 2) { } else if (cond 3) { } ...... } else if (cond N) { } else { } switch { case 1: .... case 2: .... .... case N: ... default: ... } Difference: In the if else blocks, if one condition is satisfied, all other blocks are ignored In Switch blocks, unless you have break statements inside each condition block, the subsequent blocks would not be ignored.


How if else if statement is differ from switch in general in java?

An else statement is comparing to items, while a switch statement is used to compare multiple items. So if you need multiple results from one statement use a switch but for booleans or very specific functions use a if else statement. Else If ex. if(a=6){System.out.println("It is six");} else(){System.out.println("It is not six");} Switch ex. switch(a){ case 1: System.out.println("it is one"); break; case 2: System.out.println("it is two"); break; default: System.out.println("it is not one or two"); break; } Basically a switch is a good way to check against a lot of possibilities.


Which statement should you use if you have multiple conditions to check for the same variable?

SWITCHswitch( yourVar ){case 'A':foo++;case 'a':bar++;default :baz++;}The switch statement will only work with integer or character variables, however. If your variable is not of that simple type, then the switch statement will not work. In that case you need to use the standard if-then-else-if sequencing.