|Navigation: Language Reference > 2 - Program Source Code Format > Program Format >====== Statement Execution Sequence ======|
In the CODE section of a Clarion program, statements are normally executed line-by-line, in the sequence in which they appear in the source module. Control statements and procedure calls are used to modify this execution sequence.
PROCEDURE calls modify the execution sequence by branching to the called procedure and executing the code contained in it. Control returns to the executable statement following the procedure call when a RETURN statement is executed in the called procedure, or there are no more statements in the called procedure to execute, returning the value (if the PROCEDURE returns a value).
Control structures–IF, CASE, LOOP, ACCEPT, and EXECUTE–change the execution sequence by evaluating expressions. The control structure conditionally executes statements contained within the structure based on the evaluation of the expression(s) in the structure. ACCEPT is also a loop-type of structure, but does not evaluate any expression.
Branching also occurs with the GOTO, DO, CYCLE, BREAK, EXIT, and RETURN statements. These statements immediately and unconditionally alter the normal execution sequence.
The START procedure begins a new execution thread, unconditionally branching to that thread at the next instance of ACCEPT following the START. However, the user may choose to activate another thread by clicking the mouse on the other thread's active window.
ComputeTime PROCEDURE(*GROUP) !Passing a group parameter
MatchMaster PROCEDURE !Passing no parameters
ParmGroup GROUP !Declare a group
CODE !Begin executable code
FieldTwo = CLOCK() !Executes 1st
ComputeTime(ParmGroup) !Executes 2nd, passes control to procedure
MatchMaster !Executes after procedure executes fully