Replacing a switch
From: Paul F. Johnson (paul_at_all-the-johnsons.co.uk)
Date: 01/15/04
- Next message: Robert W Hand: "Re: Newbie Question about main"
- Previous message: Josh Sebastian: "Re: Newbie Question about main"
- Next in thread: Ulrich Eckhardt: "Re: Replacing a switch"
- Reply: Ulrich Eckhardt: "Re: Replacing a switch"
- Reply: David White: "Re: Replacing a switch"
- Reply: Robert W Hand: "Re: Replacing a switch"
- Reply: James Connell: "Re: Replacing a switch"
- Reply: EventHelix.com: "Re: Replacing a switch"
- Reply: James Connell: "Re: Replacing a switch"
- Reply: Jerry Coffin: "Re: Replacing a switch"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 14 Jan 2004 23:01:33 +0000
Hi,
I'm trying to re-write this piece of code. I've seen it done another way
which was much nicer (to my mind)
The code is
string t;
switch (Einhaft)
{
case 0:
t = " pt";
break;
case 1:
t = " mm";
break;
case 2 :
t = " pica";
break;
}
Now, I'm trying to change this to be something like
t = ((" pt" && Einhaft == 0) || (" mm" && Einhaft == 1) ||
(" pica" && Einhaft == 2));
A quick test and this will compile, but t doesn't contain what I would
have thought it would contain.
Any ideas what I'm doing wrong?
TTFN
Paul
- Next message: Robert W Hand: "Re: Newbie Question about main"
- Previous message: Josh Sebastian: "Re: Newbie Question about main"
- Next in thread: Ulrich Eckhardt: "Re: Replacing a switch"
- Reply: Ulrich Eckhardt: "Re: Replacing a switch"
- Reply: David White: "Re: Replacing a switch"
- Reply: Robert W Hand: "Re: Replacing a switch"
- Reply: James Connell: "Re: Replacing a switch"
- Reply: EventHelix.com: "Re: Replacing a switch"
- Reply: James Connell: "Re: Replacing a switch"
- Reply: Jerry Coffin: "Re: Replacing a switch"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|