Weekly_4 - in the code(Subroutines can even be called...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
ChE 3171, Spring 2010, Week 4 GoTo statements for unconditional and conditional branching: GoTo linelabel ... linelabel: or If condition GoTo linelabel ... linelabel: While loops: While condition Block of statements Wend For loops: For counter = Start To end [ Step Stepsize ] Block of statements Next counter The step size part of the syntax is optional and when not used, the default step size is 1. Nested loops: For loops can be nested the obvious way. Both inside other For-loops or inside While-loops. And While-loops can be inside other While-loops or inside For-loops. Subroutines that execute a piece of code (similar to a macro) can be “called” from anywhere else
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: in the code. (Subroutines can even be called recursively). To call a subroutine use Call SubroutineName ( Argument list ) A syntax for a subroutine is Public Sub SubroutineName ( Argument list ) Block of statements End Sub The argument list can contain both input and output variables and these variables must be declared in the calling program, not in the subroutine. Variables that are local to the subroutine must be declared in the subroutine. 1...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online