KILL

Syntax: kill file$
Type: statement

deletes a file from disk.

e.g.


kill "file.ext"



See also shell.
 

Label

local labels can now have the same name in different procs (v1c)

LBOUND

Syntax: lbound(array[, dimension])
Type: function

Lbound returns the lowest index that can be used in the array 'array'.

Optionally 'dimension' says what dimension to check the lowest bound. 1 for first dimension, and 2 for second dimension etc.

e.g.


dim array(-10 to 10, 5 to 15, 1 to 2) as integer
print lbound(array, 1) 'returns -10
print lbound(array, 2) 'returns 5
print lbound(array, 3) 'returns 1



See also ubound, dim.

LCASE$

Syntax: lcase$ (text$)
Type: function

returns the input string making all letters in lower case.

e.g.

print lcase$("Hello World abCDefGH")



See also ucase$.

LEFT$

Syntax: left$(text$, n)
Type: function

returns 'n' amount of characters starting from the left of 'text$'.

e.g.


text$ = "hello world"
print left$(text$, 5) 'returns "hello"



See also right$, mid$ (function).

LEN

Syntax: len(variable)
Type: function

Returns the size of a variable in bytes. This can be used with strings (returns the length in characters), integers, custom types, etc.
LEN() now accepts PTR's when used with ENUM's and UDT's (v1c)
LEN() can now handle arrays with no indexes given, as in QB (v1c)

e.g.

print len("hello world") 'returns "11"



This is similar to the cc++ command 'sizeof()'.

Differences:
Between QB:
Works with UDT's and types too.

e.g.


a = a + len( integer )

LET

Syntax: [let ]variable = value
Type: statement

Useless command that does nothing, simply compadible with old basic dialects.

e.g. these two lines have the same effect:


let x = 100
x = 100



As you can see the let statement is not needed.

lib

Differences:
New to FreeBasic.

LINE (Graphics)

Syntax: line [[step] (x1, y1)]-[step] (x2, y2)[, [color][, [b|bf][, style]]]
Type: statement
Category: Gfx

Graphics statement that draws a straight line or a box between two points.

LINE coordinates are affected by last WINDOW and VIEW (graphics) statements, and respect clipping rect set by VIEW (graphics).

e.g. draws a diagonal red line with a white box, and waits for 3 seconds


dim t as single
screen 13
line (20, 20)-(300, 180), 4 'diagonal red line
line (140, 80)-(180, 120), 15, b
t = timer
do
loop until timer > t + 3



See also circle, window, view (graphics).

LINE INPUT

Syntax: LINE INPUT[;] ["promptstring";] stringvariable
Type: statement
Category: Input

To read an entire line of text from the keyboard input and store in a variable.

v1c, unfinished.

LINE INPUT #

Type: statement
Category: File

LOBYTE
LOWORD, HIWORD, LOBYTE and HIBYTE intrinsic macros (v1c)

loc

Syntax: loc (file slot)
Type: function
Category: File

Returns the position with an open file (in binary mode).

See also lof, open.

Differences:
Between QB:
No support to file modes other than the binary file mode.

LOCAL

Type: keyword
Category: Error
LOCAL keyword to be used with ON ERROR statments, when inside sub-routines (v1c)

LOCATE

Syntax: locate [row][, column]
Type: statement
Category: Console

Sets the console cursor to the row and column given.

Row is the up-down position in the console.
Column is the left-right position in the console.

Differences:
Between QB:
there are no cursor, start and stop optional arguments.

LOCK

Syntax: LOCK fileslot [, {record | [start] TO end}]
Type: statement
Category: File

Lock will restrict access to a file or part of a file if given the record number or the start and end positions.

Lock is useful when multiple programs, people, or threads are trying to access the same file.

See unlock for the opposite command. Unlock uses the same syntax, so to properly lock and unlock a file you will give the same paramaters to unlock that you did to lock.

e.g. locking a file, reading 100 bytes, and unlocking it. To run, make sure there exists a file called 'file.ext' in the current directory that is at least 100 bytes.


dim array(1 to 100)
f = freefile
open "file.ext" for binary as #f
lock #f, 1 to 100
for i = 1 to 100
get #f, i, array(i)
next
unlock #f, 1 to 100
close #f



See also unlock, open.

LOF

Syntax: lof (file slot)
Type: function
Category: File

Returns the length of file of an open file given the file slot.

e.g.


f = freefile
open "file.ext" for binary as #f
print lof(f)
close #f

See also loc, open.

LOG

Syntax: log (number)
Type: function
Category: math

Returns the logarithm of the input 'number' with log base e (natural log). e is approximately 2.718.

To calculate the log base x of a number one would do this:


function LogX! (number!, x!)
LogX! = log(number!) / log(x!)
end function

print LogX!(100, 10) 'returns 2

LONG

Type: data type

See integer, since so far, integers and longs are the same.

See also data types.

LOOP

Type: keyword
Category: control flow

See do...loop.
 

LOWORD
LOWORD, HIWORD, LOBYTE and HIBYTE intrinsic macros (v1c)

LSET

Syntax: lset string_var, string_expression
Type: statement
Category: File

LSET left justifies text into the string buffer 'string_var', filling the left part of the string with 'string_expression' and the right part with spaces.

e.g.


buffer$ = space$(10)
lset buffer$, "91.5"
print "-["; buffer$; "]-"

See also rset, space$, put (file i/o), mkd$, mki$, mkl$, mks$.

Differences:
Between QB:
syntax is "LSET dst, src" not "LSET dst = src"

LTRIM$

Type: function

Ltrim (left trim) trims the leading white space.

e.g.


print ltrim$(" hello") 'returns "hello"



See also rtrim$.