0 like 0 dislike
54 views
in Computer Science by (1.0m points)
What is Switch statement? Give example.

1 Answer

0 like 0 dislike
by (1.0m points)
The if..else..if ladder allows you to execute a block code among many alternatives. If you are checking on the value of a single variable in if...else...if, it is better to use switch statement.

The switch statement is often faster than nested if...else (not always). Also, the syntax of switch statement is cleaner and easy to understand.

When a case constant is found that matches the switch expression, control of the program passes to the block of code associated with that case.

Suppose, the value of n is equal to constant2. The compiler executes the statements after case constant2: until break is encountered. When break statement is encountered, switch statement terminates.
by
500 Mg Amoxil  <a href=http://cialibuy.com>cialis</a> Levitra Herzrasen
by
by

Related questions

0 like 0 dislike
1 answer 28 views
0 like 0 dislike
0 answers 38 views
0 like 0 dislike
1 answer 26 views
0 like 0 dislike
1 answer 59 views
asked Feb 14, 2019 in Computer Science by danish (1.0m points)
0 like 0 dislike
1 answer 34 views
0 like 0 dislike
1 answer 39 views
0 like 0 dislike
1 answer 49 views
0 like 0 dislike
1 answer 166 views
asked Nov 8, 2018 in General Science by danish (1.0m points)
0 like 0 dislike
1 answer 29 views
0 like 0 dislike
0 answers 42 views
Welcome to Free Homework Help, where you can ask questions and receive answers from other members of the community. Anybody can ask a question. Anybody can answer. The best answers are voted up and rise to the top. Join them; it only takes a minute: School, College, University, Academy Free Homework Help

19.4k questions

18.3k answers

8.7k comments

4.1k users

Free Hit Counters
...