RE: If statements inside switch statements?

  • From: "DaShiell, Jude T. CIV NAVAIR 1490, 1, 26" <jude.dashiell@xxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Mon, 26 Jul 2010 13:31:55 -0400

Usually an if then else statement needs the then keyword after the right
parens and before that left bracket in order to work correctly.  I'm
pretty sure if pascal was being used as a language this error would have
been flagged by pascal with something like missing then in if then else
statement.  Other programming languages will let programmers hang
themselves by not flagging such errors.

-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Homme, James
Sent: Monday, July 26, 2010 13:12
To: programmingblind@xxxxxxxxxxxxx
Subject: RE: If statements inside switch statements?

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

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

Other related posts: