Bay Six Software Forum Index Bay Six Software
Beyond the Basics
 
 FAQFAQ   SearchSearch   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Porting MS-DOS BASIC code to LB More Info
 
The following sections will describe how to convert statements that have no direct equivalent in LB.

DECLARE
Defines forward declarations of procedures. These are not needed in LB.

DIM SHARED
Declares global variables.
DIM SHARED variablelist
Code:
Global variablelist


DEF FN
Defines a simple function.
DEF FNname(parameterlist) = expression
Code:
Function FNname(parameterlist)
  FNname = expression
End Function

While many DOS BASICs require DEF FN's to be placed near the beginning of a program, LB functions must be placed near the end.

ERASE
Frees the memory allocated to an array.
ERASE arrayname
Code:
ReDim arrayname(0)


ON...GOSUB and ON...GOTO
Causes execution to jump to one of a list of line numbers/labels based on the value of an expression.
ON expression GOSUB label1, label2, ...
ON expression GOTO label1, label2, ...

Code:
Select Case expression
Case 1
  ' GoSub/GoTo [label1] or just inline code here
Case 2
  ' Ditto for [label2]
' ...
End Select

Powered by phpBB © 2001, 2005 phpBB Group