RE: If statements inside switch statements?

  • From: "Homme, James" <james.homme@xxxxxxxxxxxx>
  • To: "programmingblind@xxxxxxxxxxxxx" <programmingblind@xxxxxxxxxxxxx>
  • Date: Mon, 26 Jul 2010 13:12:28 -0400

Hi,
Would you not want to use break; to stop the code from falling through?

Thanks.

Jim

Jim Homme,
Usability Services,
Phone: 412-544-1810. Skype: jim.homme
Internal recipients,  Read my accessibility blog. Discuss accessibility here. 
Accessibility Wiki: Breaking news and accessibility advice

-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx 
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Tyler Littlefield
Sent: Monday, July 26, 2010 12:01 PM
To: programmingblind@xxxxxxxxxxxxx
Subject: Re: If statements inside switch statements?

What do you mean? else on switch looks like:
switch (i)
{
case 1:
case 2:
//tests for boty 1 and 2
//do something here
case 3:
//do something else here
default:
//else
}

                Thanks,
Tyler Littlefield
        http://tds-solutions.net
        Twitter: sorressean

On Jul 26, 2010, at 9:35 AM, Jes wrote:

> Hi all,
>
> Is it efficient on the computer's resources if I place an if statement inside 
> a switch statement?
> The reason I ask is because for whatever reason, I can't get my else clause 
> to work. Switch, on the other hand, works just fine.
> Jes
>
> __________
> View the list's information and change your settings at
> //www.freelists.org/list/programmingblind
>

__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind


This e-mail and any attachments to it are confidential and are intended solely 
for use of the individual or entity to whom they are addressed.  If you have 
received this e-mail in error, please notify the sender immediately and then 
delete it.  If you are not the intended recipient, you must not keep, use, 
disclose, copy or distribute this e-mail without the author's prior permission. 
 The views expressed in this e-mail message do not necessarily represent the 
views of Highmark Inc., its subsidiaries, or affiliates.
__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind

Other related posts: