Go to Post Welcome to ChiefDelphi a month before Kick-Off. This is an annual traditional experience for quite a few regulars. - synth3tk [more]
Home
Go Back   Chief Delphi > Technical > IT / Communications
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #10   Spotlight this post!  
Unread 13-11-2007, 22:58
jee7s jee7s is offline
Texan FIRSTer, ex-frc2789, ex-frc41
AKA: Jeffrey Erickson
FRC #6357
 
Join Date: Nov 2007
Rookie Year: 1997
Location: Dripping Springs, TX
Posts: 315
jee7s has a reputation beyond reputejee7s has a reputation beyond reputejee7s has a reputation beyond reputejee7s has a reputation beyond reputejee7s has a reputation beyond reputejee7s has a reputation beyond reputejee7s has a reputation beyond reputejee7s has a reputation beyond reputejee7s has a reputation beyond reputejee7s has a reputation beyond reputejee7s has a reputation beyond repute
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
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

vB 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
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


All times are GMT -5. The time now is 19:35.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi