Register on the forum now to remove ALL ads + popups + get access to tons of hidden content for members only!

Go Back   Site Owners Forums - Webmaster Forums > Web Programming > Programming General

Notices


Reply
 
Thread Tools Rate Thread Display Modes
Old 06-18-2016, 02:37 AM   #1
Shivangi Panwar
Registered User
 
Join Date: Nov 2015
Posts: 144
What is default switch case?

What is default switch case?
Shivangi Panwar is offline   Reply With Quote

Old 07-01-2016, 11:30 PM   #2
Kiara
Registered User
 
Join Date: Jun 2016
Location: USA
Posts: 67
The switch and case keywords evaluate an expression and execute any statement associated with a constant expression whose value matches the initial expression.
If there is no match with a constant expression, the statement associated with the default keyword is executed. If the default keyword is not used, control passes to the statement following the switch block.
Kiara is offline   Reply With Quote
Old 07-05-2016, 12:03 AM   #3
smmexpertss
Registered User
 
Join Date: Sep 2015
Location: UK
Posts: 625
The condition of a switch statement is a value. The case says that if it has the value of whatever is after that case then do whatever follows the colon. The break is used to break out of the case statements. Break is a keyword that breaks out of the code block, usually surrounded by braces, which it is in. In this case, break prevents the program from falling through and executing the code in all the other case statements. An important thing to note about the switch statement is that the case values may only be constant integral expressions.
smmexpertss is offline   Reply With Quote
Old 07-05-2016, 12:23 AM   #4
yadavji83
Registered User
 
Join Date: Jul 2016
Location: Delhi, India
Posts: 10
Its like a simple form of if else loop or simply saying do this if its true or this or this or this.... Its syntax is simple so people tend to use it rather than if else.
yadavji83 is offline   Reply With Quote
Old 07-26-2017, 03:23 AM   #5
adityadev
Registered User
 
Join Date: Jul 2017
Posts: 106
The switch and case keywords evaluate expression and execute any statement associated with constant-expression whose value matches the initial expression. If there is no match with a constant expression, the statement associated with the default keyword is executed.
adityadev is offline   Reply With Quote
Old 07-27-2017, 03:43 AM   #6
Jessianut
Registered User
 
Join Date: Jul 2017
Posts: 465
The switch and case keywords evaluate expression and execute any statement associated with constant-expression whose value matches the initial expression. If there is no match with a constant expression, the statement associated with the default keyword is executed
Jessianut is offline   Reply With Quote
Old 07-31-2017, 04:12 AM   #7
Sarahlilly
Registered User
 
Join Date: Jul 2017
Posts: 83
The switch and case keywords evaluate expression and execute any statement associated with constant-expression whose value matches the initial expression. If there is no match with a constant expression, the statement associated with the default keyword is executed.
Sarahlilly is offline   Reply With Quote
Old 02-12-2018, 04:17 AM   #8
spurtcommerce
Registered User
 
Join Date: Oct 2017
Posts: 39
The switch and case keywords evaluate expression and execute any statement associated with constant-expression whose value matches the initial expression. If there is no match with a constant expression, the statement associated with the default keyword is executed.
__________________
Node js Ecommerce | Angularjs Ecommerce
spurtcommerce is offline   Reply With Quote
Old 02-15-2018, 02:08 AM   #9
thevyakar
Registered User
 
Join Date: Nov 2017
Location: USA
Posts: 113
The switch condition is executed once.The value of the condition is matched with each case.If there is a match, then that particular matched case code executes.
thevyakar is offline   Reply With Quote
Old 02-16-2018, 03:27 AM   #10
albertomorrison
Registered User
 
Join Date: Dec 2017
Location: Santa Clara, California, USA
Posts: 91
Visual Studio 6.0
switch( expression )
{
[case constant-expression:]
. . .
[statement]
. . .
[default:
statement]
}

The switch and case keywords evaluate an expression and execute any statement associated with constant-expression whose value matches the initial expression.

If there is no match with a constant expression, the statement associated with the default keyword is executed. If the default keyword is not used, control passes to the statement following the switch block.
albertomorrison is offline   Reply With Quote
Old 02-17-2018, 09:45 AM   #11
smmexpertss
Registered User
 
Join Date: Sep 2015
Location: UK
Posts: 625
The body of a switch statement is known as a switch block. A statement in the switch block can be labeled with one or more case or default labels. The switch statement evaluates its expression, then executes all statements that follow the matching case label.
smmexpertss is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Looking for a new case or cover to protect your new MacBook Air? sophia21 General Discussion 1 09-18-2018 02:53 AM
Get massage therapists insurance—just in case jamesalex General Discussion 7 02-21-2018 10:58 PM
Transfer Switch Market Aadolf General Discussion 2 12-21-2017 02:58 AM
What’s the purpose of using Break in each case of Switch Statement? Shivangi Panwar Java 3 06-06-2016 10:40 PM
How to set up of custom html default error pages jennypretty Search Engine Optimization 1 01-03-2012 08:21 AM


All times are GMT -7. The time now is 11:33 AM.


Powered by vBulletin Copyright © 2013 vBulletin Solutions, Inc.