13.07.2015 Views

Turbo Basic

Turbo Basic

Turbo Basic

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

See AlsoExamplecreates three local· variables: scalar variables a% and b# (integerand double precision,. respectively), and .integer array bigArray%.The array must. then be dimensioned appropriately:DIM DYNAMIC bigArray%(lOOO)Local array variables must be dynamic. They are automaticallydeallocated when the procedure. terminates.Static·and Shared VariablesBy ·default, variables that appear within procedure definitionshave the local attribute. However, since this default is subject tochange, you should make an effort to d~clare every variable used ina procedure.Use the SHARED statement to declare variables that are globalto the rest of the program.Declare variables with the STATIC statement if it is importantthat a variable not lose its value with every invocation.A procedure definition must be terminated with END DEF,which logically returns control to the statement directly after theinvoking CALL. Use the EXIT SUB statement to return from aprocedure definition from someplace other than· at its end.$INLINECALL·EXIT SUBLOCALSHAREDSTATICDIM Array(l)'declare array of numbersSUB TestProcedure(I%, L&, S!, Of, E, A(l», SUB/END SUB outputs the values of, each parameter passed to itPRINT 1%; L&; S!; Of; E; A(O)END SUB 'end procedure TestProcedureInteger% = 1Longlnt& = 2SinglePre! = 3Doub1ePre# = 4Array(O) = 5CALL TestProcedure (Integer%, Longlnt&, Si ng1 ePre! ,_DoublePre#, Integer% A2,Array(»END' end the program<strong>Turbo</strong> <strong>Basic</strong> Reference Directory 355

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!