Community QBasic

Rebooting the QBasic we all know and love!


Project maintained by Cory Smith

FUNCTION

Declares a user-defined function.

Syntax

FUNCTION function_name [ ( arguments ) ] [ STATIC ] … function_name = expressionEND FUNCTION

Notes

Example

FUNCTION Min% (a AS INTEGER, b AS INTEGER)
  IF (a < b) THEN
    Min% = a
  ELSE
    Min% = b
  END IF
END FUNCTION

PRINT "Min of 5 and 3 is"; Min%(5, 3)

See Also