|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#10
|
|||
|
|||
|
Re: Visual Basic
Yes, that's a switch-case statement. However, a fall-through switch case statement is a little different:
int i,x,y,z; switch(i) { case(1): x = 4; case(2): y = 4; case(3): z = 4; break; default: x = y = z = 0; break; } This code sets: x,y,z to 4 if i = 1 y, z to 4 if i = 2 z to 4 if i = 3 x, y, z to 0 else It's called "fall through" because there are no break statements in the early set of cases. This means that the case i == 1 falls through to i == 2 which in turn falls through to i == 3. There are many situations where this is useful, especially if the cases for i are not mutually exclusive. From my understanding of VB, the above block would have to be coded this way: Select(i) case(1): x = 4 y = 4 z = 4 case(2): y = 4 z = 4 case(3): z = 4 default: x = 0 y = 0 z = 0 End Select I might be wrong about that VB switch statement, but I'm pretty sure it doesn't support the fall-through idea. de KG2OV |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Visual Basic help needed. | Cody Carey | Programming | 1 | 25-02-2007 15:06 |
| Visual Basic Scouting Problem | Jeffel | Programming | 7 | 11-02-2005 19:30 |
| Visual Basic | dddriveman | Programming | 12 | 20-03-2004 13:03 |
| Visual Basic 6 Dashboard | LBK Rules | Programming | 1 | 22-01-2003 13:06 |