END Statement

Previous  Next

 

END [exitcode]

END FUNCTION

END SUB

 


 

This is the standard Basic END program statement with an optional exit code or the end of a FUNCTION or SUB subprogram.  If the exit code is omitted, the default edit code is 0 (success).  The END statement should be the last statement in a MyBASIC2 program.  The FUNCTION exit code depends on the function return type and the SUB program doesn't have an exit code.

 

To terminate a MyBASIC2 program prematurely you should use the STOP statement.

 

Examples:

 

FUNCTION Kalle( BYVAL nils AS STRING ) AS INTEGER

  IF nils = "Kalle" THEN

     Kalle = TRUE

  ELSE

     Kalle = FALSE

  ENDIF

END FUNCTION

 

SUB Nisse( BYVAL nils AS STRING )

  PRINT "Name: ";nils

END SUB

 

DIM name AS STRING

 

name = "Kalle"

 

CALL Nisse( name )

 

IF Kalle( name ) THEN

  PRINT " [ful filur]",

ELSE

  PRINT " [good guy]",

ENDIF

 

END