Syntax: data constant [,constant]...
Type: statement
stores data within the program, basicly having file storage within the end executable file. Data can only store constants (integer/decimal number or string).
DATA should not be allowed inside procs (v1c)
An example of storing 10 pieces of data:
To access the data you use the command read. An example
of reading 10 pieces of data:
Differences:
Between QB:
string value MUST be quote'd; Const's are evaluated before storing.
Empty null data items are not supported (asin DATA 1, 3, 2,, 5).
Type: keyword
Used to return the current date, or set a new date for the system.
e.g. to get the current date:
See also setdate, time$, timer.
Differences:
Between QB:
To set the date, you must use SETDATE now.
Syntax: (sub( byval src as any ptr ))
Type: statement
Deallocates memory allocated with allocate. See allocate for more details.
Differences:
New to FreeBasic.
Syntax: declare {sub | function} name [lib "mydll"][alias "AddNumbers"] ([parameter
[, parameter]...]) [as return_type]
Type: statement
This informs the compiler (and developers) that a function or sub exists and
contains all details it needs for calling, the number of parameters and their
data type, and the return type.
It is useful to seperate declare statements into include files, though they can
simply be at the top of your BAS source file.
It is required however for the declare statement to be before the sub/function
itself (unless the sub/function is in a library which will be documented later).
e.g. using declare:
Syntax: defbyte letterrange[, letterrange]...
Type: statement
Defbyte is used to default variables to a byte number
that start with a letter in the range given.
For the syntax, letterrange is in the form of letter-letter, or just letter.
for example:
this will make 'bNumber' a byte number since it's first
letter starts with b.
See also defdbl, defint,
deflng, defshort,
defsng, defstr,
defubyte, defuint, defushort.
Differences:
New to FreeBasic.
Syntax: DEFDBL letterrange[, letterrange]...
Type: statement
Defdbl is used to default variables to a double-precision
decimal number that start with a letter in the range given.
For the syntax, letterrange is in the form of letter-letter, or just letter.
for example:
this will make 'a' a double-precision decimal number since
it is in the range of a-d.
See also defbyte, defint,
deflng, defshort,
defsng, defstr,
defubyte, defuint, defushort.
Syntax: defined (symbol name)
Type: function
Category: pre-processor
Given the symbol name, defined() returns true if the symbol has been defined
- or false if the symbol is unknown of.
This is used mainly with #if, and possibly with
if...then.
Similar to #ifdef except it allows more than one check to
occur because of its flexibility.
e.g. - which symbols are defined out of a, b, c, and d ?
Differences:
New to FreeBasic.
Syntax: DEFINT letterrange[, letterrange]...
Type: statement
Defint is used to default variables to a integer
number that start with a letter in the range given.
For the syntax, letterrange is in the form of letter-letter, or just letter.
for example:
this will make 'iNumber' an integer number since it's
first letter starts with i.
See also defbyte, defdbl,
deflng, defshort,
defsng, defstr,
defubyte, defuint, defushort,
integer.
Type: statement
Deflng is used to default variables to a long integer
number that start with a letter in the range given.
For the syntax, letterrange is in the form of letter-letter, or just letter.
for example:
this will make 'lNumber' a long integer number since it
starts with l.
See also defbyte, defdbl,
defint, defshort,
defsng, defstr,
defubyte, defuint, defushort.
Syntax: defshort letterrange[, letterrange]...
Type: statement
Defshort is used to default variables to a short number
that start with a letter in the range given.
For the syntax, letterrange is in the form of letter-letter, or just letter.
for example:
this will make 'sNumber' a short number since it's first
letter starts with s.
See also defbyte, defdbl,
defint, deflng,
defsng, defstr, defubyte,
defuint, defushort.
Differences:
New to FreeBasic.
Type: statement
Defsng is used to default variables to a single-precision
decimal number that start with a letter in the range given.
For the syntax, letterrange is in the form of letter-letter, or just letter.
for example:
this will make 'sNumber' and 'yNumber' a single-precision
decimal number since it is in the range of s-z.
See also defint, defdbl,
deflng, defstr,
single.
Type: statement
Defstr is used to default variables to a string that
start with a letter in the range given.
For the syntax, letterrange is in the form of letter-letter, or just letter.
for example:
this will make 'sMessage' a string since it starts with s.
See also defint, defsng,
deflng, defdbl,
double.
Syntax: defubyte letterrange[, letterrange]...
Type: statement
Defubyte is used to default variables to a ubyte number
that start with a letter in the range given.
For the syntax, letterrange is in the form of letter-letter, or just letter.
for example:
this will make 'uNumber' a ubyte number since it's first
letter starts with u.
See also defint.
Differences:
New to FreeBasic.
Syntax: defuint letterrange[, letterrange]...
Type: statement
Defuint is used to default variables to a uinteger
number that start with a letter in the range given.
For the syntax, letterrange is in the form of letter-letter, or just letter.
for example:
this will make 'uNumber' a uinteger number since it's
first letter starts with u.
See also defint.
Differences:
New to FreeBasic.
Syntax: defushort letterrange[, letterrange]...
Type: statement
Defushort is used to default variables to a ushort
number that start with a letter in the range given.
For the syntax, letterrange is in the form of letter-letter, or just letter.
for example:
this will make 'uNumber' a ushort number since it's first
letter starts with u.
See also defint.
Differences:
New to FreeBasic.
Syntax: dim var as type[, var as type]...
Type: statement
Declares data with a set size and type.
This can declare single variables, or arrays (many variables with the same name
referenced with an index).
DIM|REDIM array w/o explicit dimensions is not allowed anymore inside procs, as
the descriptor size is unknown (v1c)
Single variables are declared simply like so:
New syntax DIM AS INTEGER Lb, Ub, I, J, M, M1
DIM array(), dynamic arrays with unknown dimensions as in VBDOS/VB (v1c)
Now imagine you wanted to store 100 numbers of your height over every day of
the year. Perhaps 1000 numbers. Using dim to declare 100-1000 numbers will be
rediculous, and this is what arrays are for. To dim 1000 numbers under one
variable (I will call this 'height') it is simply done like so:
That allows the index to start at 1 and finish at 1000, giving the variable 'height'
1000 slots of data. This can be alternatively coded like so:
That will give 'height' 1000 data slots, ranging from 0 to 999 (the default
starting value is 0).
See
data types.
Differences:
Between QB:
if using non-constants as indexes, use REDIM or $DYNAMIC first. (This may change
in the future).
Syntax: dir$ (filespec$, attrib as integer)
Type: function
Category: file
Returns files in the current directory/folder. Results can be filtered with a
filespec (more later) and with a matching file attribute.
'attrib' is a combination of the following attributes:
1 - read only
2 - hidden
4 - system
16 - directories
32 - archive
e.g. to list all directories and archive files:
See also open, curdir$,
mkdir, rmdir, files.
Differences:
Between QB:
New addition to FreeBasic.
Type: statement
Category: control flow
Repeats a block of statements until/while a contition is met.
Syntax 1:
do [{until | while} condition]
loop
Syntax 2:
do
loop [{until | while} condition]
for example:
This will continue to print "hello" on the screen until the condition (a > 10)
is met.
See also for...next,
while...wend.
Type: data type
Double is a 64-bit, floating point data type used to store precise decimal
numbers. They are similar to single data types but more
precise.
However precise double's are, they still have limited accuracy and this can
amount to huge losses in accuracy if not used properly.
Example of using a double variable.
See also
data types.
Syntax: Draw cmds$
Type: statement
Category: Gfx
Statement for sequenced pixel plotting.
The DRAW statement can be used to issue several drawing commands all at once; it
is useful to quickly draw figures. The command string accepts the following
commands:
Commands to plot pixels: B Optional prefix; move but do not draw. N Optional prefix; draw but do not move. Mx,y Move to specified screen location; if + or - precedes x, movement is relative to current cursor position. U[n] Move n units up. If n is omitted, 1 is assumed. D[n] Move n units down. If n is omitted, 1 is assumed. L[n] Move n units left. If n is omitted, 1 is assumed. R[n] Move n units right. If n is omitted, 1 is assumed. E[n] Move n units up and right. If n is omitted, 1 is assumed. F[n] Move n units down and right. If n is omitted, 1 is assumed. G[n] Move n units down and left. If n is omitted, 1 is assumed. H[n] Move n units up and left. If n is omitted, 1 is assumed. Commands to color: Cn Changes current foreground color to n. Pp,b Flood fills region with border color b with color p. Commands to scale and rotate: Sn Sets the current unit length; default is 4 pixels per unit. An Rotate n*90 degrees (n ranges 0-3). TAn Rotate n degrees (n ranges 0-359). Extra commands: Xp Executes commands a address p. For example, you can do: down10$ = "D10" : DRAW "U10R5X" + VARPTR(down10$) + "L5"
DYLIBLOAD and DYLIBSYMBOL intrinsic functions to manage dynamic libraries at runtime (lillo)
DYLIBLOAD and DYLIBSYMBOL intrinsic functions to manage dynamic libraries at runtime (lillo)