borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (GRAM-SCHMODT ORTHOGONALIZATION)Next Topic (Bar at screen bottom) New Topic New Poll Post Reply
AndreaVB Forum : VB General : Control Structures
Poster Message
Shane
Level: Guest


icon Control Structures

Im Presently studying 'CONTROL STRUCTURES' they are using lyrics from a old blues sont to do this. This is all well and good for the theory behind it.
Im following the principles ie:

. Sequence
. Selection
. Iteration

And also the use of:

IF - THEN - ELSE
DO - WHILE - ENDO
                  - WEND
DO - UNTIL

Buty what i would like to see are some simple code examples in VB to see practicle uses of control structures. I feel this would make it clearer to me in understanding it in programming uses. Can anyone help?

Regards
VBTRAINEE

08-02-2004 at 02:18 PM
| Quote Reply
Shock
Level: VB Lord


Registered: 30-03-2003
Posts: 150
icon Re: Control Structures

Its all very logical...Basic was written so that any person could see the logic behind the commands.

im going to type the commands in caps, and the rest will be just normal english, then I will give a more accurate code example:

(this is an expanded version, there is a simpler type)
IF im hungry
THEN
eat:drink:sleep
ELSE IF im too tired
THEN sleep
ELSE do nothing much..
END IF

(the simpler type, using basic code)
IF a=1 THEN BEEP else msgbox$ "a is not 1!!!'


the DO is a loop type:
a = 0
DO WHILE a < 5
a = a + 1:debug.? a
WEND
(youll get this in debug:
1
2
3
4
5)


the while parrameter can be removed...so that it will loop infinitely (this is very usefull for many game types and basic utilities). WEND just means go back to the DO, and check for the while parameter if its either true or false.
UNTIL parameter is just what its word implies...does something untill something else is true.

theres also the FOR:NEXT while is my personal favorite (:grin.

FOR x = 1 to 5
debug.? x
NEXT x

(youll get this in debug:
1
2
3
4
5)

hope this helps any...

08-02-2004 at 06:15 PM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : VB General : Control Structures
Previous Topic (GRAM-SCHMODT ORTHOGONALIZATION)Next Topic (Bar at screen bottom) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder