SUB Statement

Previous  Next

 

SUB( parameters )

 


 

Declare a function or subroutine.  This can a be local (called from within program) or external called by using a MODULE handle.  The subroutine must be ended using END SUB.  The difference between a SUB and a FUNCTION is that a function returns a value.

 

Examples:

 

FUNCTION Kalle( BYVAL nils AS STRING ) AS INTEGER

  IF nils = "Kalle" THEN

     Kalle = 1

  ELSE

     Kalle = 0

  ENDIF

END FUNCTION

 

SUB Nisse( BYVAL nils AS STRING )

  PRINT "Name: ";nils,

END SUB