Declares or redefines variables or arrays.
variable: Any variable or array name.
typename: Keyword that declares the data type of a variable.

Byte: Byte variable (0-255)
Boolean: Boolean variable (True, False)
Currency: Currency variable (Currency with 4 Decimal places)
Date. ΠΠ΅ΡΠ΅ΠΌΠ΅Π½Π½Π°Ρ Π΄Π°ΡΡ
Double: Double-precision floating-point variable (1,79769313486232 x 10E308 - 4,94065645841247 x 10E-324)
Integer. Π¦Π΅Π»Π°Ρ ΠΏΠ΅ΡΠ΅ΠΌΠ΅Π½Π½Π°Ρ (-32768 - 32767)
Long. Π¦Π΅Π»Π°Ρ ΠΏΠ΅ΡΠ΅ΠΌΠ΅Π½Π½Π°Ρ ΡΠΈΠΏΠ° Long (-2Β 147Β 483Β 648 - 2Β 147Β 483Β 647)
Object: Object variable (Note: this variable can only subsequently be defined with Set!)
Single. ΠΠ΅ΡΠ΅ΠΌΠ΅Π½Π½Π°Ρ Ρ ΠΏΠ»Π°Π²Π°ΡΡΠ΅ΠΉ ΡΠΎΡΠΊΠΎΠΉ Ρ ΠΎΠ±ΡΡΠ½ΠΎΠΉ ΡΠΎΡΠ½ΠΎΡΡΡΡ (3,402823 x 10E38 - 1,401298 x 10E-45).
String. Π‘ΡΡΠΎΠΊΠΎΠ²Π°Ρ ΠΏΠ΅ΡΠ΅ΠΌΠ΅Π½Π½Π°Ρ, ΡΠΎΡΡΠΎΡΡΠ°Ρ Π½Π΅ Π±ΠΎΠ»Π΅Π΅ ΡΠ΅ΠΌ ΠΈΠ· 64Β 000 ΡΠΈΠΌΠ²ΠΎΠ»ΠΎΠ² ASCII.
Variant: Variant variable type (contains all types, specified by definition). If a type name is not specified, variables are automatically defined as Variant Type, unless a statement from DefBool to DefVar is used.
object: Universal Network object (UNO) object or ClassModule object instance.
char: Special character that declares the data type of a variable.

In LibreOffice Basic, you do not need to declare variables explicitly. However, you need to declare arrays before you can use them. You can declare a variable with the Dim statement, using commas (,) to separate multiple declarations. To declare a variable type, enter a type-declaration character following the name or use a corresponding type keyword name.
Declaration character |
Variable type name |
% |
Integer |
& |
Long |
! |
Single |
# |
Double |
$ |
String |
@ |
Currency |
array: Array declaration.

start, end: Numerical values or constants that define the number of elements (NumberElements=(end-start)+1) and the index range.
start and end can be numerical expressions if ReDim is applied at the procedure level.
Π LibreOffice Basic ΠΏΠΎΠ΄Π΄Π΅ΡΠΆΠΈΠ²Π°ΡΡΡΡ ΠΎΠ΄Π½ΠΎ- ΠΈ ΠΌΠ½ΠΎΠ³ΠΎΠΌΠ΅ΡΠ½ΡΠ΅ ΠΌΠ°ΡΡΠΈΠ²Ρ, ΠΎΠΏΡΠ΅Π΄Π΅Π»ΡΠ΅ΠΌΡΠ΅ Ρ ΠΏΠΎΠΌΠΎΡΡΡ Π·Π°Π΄Π°Π½Π½ΠΎΠ³ΠΎ ΡΠΈΠΏΠ° ΠΏΠ΅ΡΠ΅ΠΌΠ΅Π½Π½ΠΎΠΉ. ΠΠ°ΡΡΠΈΠ²Ρ ΠΏΡΠΈΠΌΠ΅Π½ΡΡΡΡΡ, Π΅ΡΠ»ΠΈ ΠΏΡΠΎΠ³ΡΠ°ΠΌΠΌΠ° ΡΠΎΠ΄Π΅ΡΠΆΠΈΡ ΡΠΏΠΈΡΠΊΠΈ ΠΈΠ»ΠΈ ΡΠ°Π±Π»ΠΈΡΡ, ΠΊΠΎΡΠΎΡΡΠ΅ Π½ΡΠΆΠ½ΠΎ ΠΈΠ·ΠΌΠ΅Π½ΡΡΡ. ΠΡΠ΅ΠΈΠΌΡΡΠ΅ΡΡΠ²ΠΎ ΠΌΠ°ΡΡΠΈΠ²ΠΎΠ² Π·Π°ΠΊΠ»ΡΡΠ°Π΅ΡΡΡ Π² ΡΠΎΠΌ, ΡΡΠΎ ΠΌΠΎΠΆΠ½ΠΎ ΡΠ°ΡΡΠΌΠ°ΡΡΠΈΠ²Π°ΡΡ ΠΎΡΠ΄Π΅Π»ΡΠ½ΡΠ΅ ΡΠ»Π΅ΠΌΠ΅Π½ΡΡ Π² ΡΠΎΠΎΡΠ²Π΅ΡΡΡΠ²ΠΈΠΈ Ρ ΠΈΠ½Π΄Π΅ΠΊΡΠ°ΠΌΠΈ, ΠΊΠΎΡΠΎΡΡΠ΅ ΠΌΠΎΠ³ΡΡ Π±ΡΡΡ ΡΡΠΎΡΠΌΡΠ»ΠΈΡΠΎΠ²Π°Π½Ρ ΠΊΠ°ΠΊ ΡΠΈΡΠ»ΠΎΠ²ΡΠ΅ Π²ΡΡΠ°ΠΆΠ΅Π½ΠΈΡ ΠΈΠ»ΠΈ ΠΏΠ΅ΡΠ΅ΠΌΠ΅Π½Π½ΡΠ΅.
Arrays are declared with the Dim statement. There are multiple ways to define the index range:
Dim text(20) As String ' 21 elements numbered from 0 to 20
Dim value(5 to 25) As Integer ' 21 values numbered from 5 to 25
Dim amount(-15 to 5) As Currency ' 21 amounts (including 0), numbered from -15 to 5
REM Two-dimensional data field
Dim table$(20,2) ' 63 items; from 0 to 20 level 1, from 0 to 20 level 2 and from 0 to 20 level 3.
You can declare an array types as dynamic if a ReDim statement defines the number of dimensions in the subroutine or the function that contains the array. Generally, you can only define an array dimension once, and you cannot modify it. Within a subroutine, you can declare an array with ReDim. You can only define dimensions with numeric expressions. This ensures that the fields are only as large as necessary.