Navigation: Contents   Index   Previous   Next

function and sub declaration

Declaration of functions nd subs are similar to basic. In functions to return function values, use implicited declared variable which has the same name of the function. Parameters by reference can also be used, using BYREF directive.

Some examples:

SUB HelloWord

  (**Some code here**)

END SUB

 

SUB UpcaseMessage(Msg)

  (**Some code here**)

END SUB

 

FUNCTION TodayAsString

  TodayAsString = DateToStr(Date)

END FUNCTION

 

FUNCTION Max(A,B)

  IF A>B THEN

    MAX = A

  ELSE

    MAX = B

  END IF

END FUNCTION

 

SUB SwapValues(BYREF A, B)

  DIM TEMP

  TEMP = A

  A = B

  B = TEMP

END SUB

Navigation: Contents   Index   Previous   Next



Copyright © 1998 - 2012 Paessler AG