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}