Contents - Index


Return

 

The Return statement can only be used within Functions and Procedures.  When EES encounters a Return statement, it will exit the Function or Procedure and control will resume at the point where the Function or Procedure was called.  The Return statement is used in logic constructions with the If Then Else or Repeat-Until statement.  The following function illustrates the use of Return statement.

 

Example:

 

Function FACTORIAL2(N)

       Factorial2=1

       if (N<=1) then Return

       F:=1

       i:=1

10: i:=i+1

       F:=F*i

       If (i<N) Then GoTo 10

       FACTORIAL2:=F

End

 

Y= FACTORIAL2(0)   { Y will be set to 1 when this statement executes}