Delphi Constant
In Delphi, the versatile web-programming language, arrays allow a developer to refer to a series of variables by the same name and to use a number—an index—to tell them apart.
Variables are indispensable in programming. A program wouldn't do much things without variables.
A variable links a name to a value. You must not confuse its name and its value. A variable is not constant. It may change during the application execution.
- 1Variables and program
- 2The constants

Variables and program[edit]
Variable declaration in the program[edit]
To declare a variable in a program, you have to write:
- var
- The variable name (var1, for example)
- :
- Its type (integer, for example)
- ;
An example:
Delphi Constant Expression Expected
You can also write:
Right syntax for the variable names[edit]
| Rules | Wrong identifiers | Right identifiers |
|---|---|---|
| Must not start with a number | 1name | name1 |
| Dots are not allowed | name.2 | name_2 |
| Dashes are not allowed | -name-3 | _name_3 |
| Spaces are not allowed | Variable name | Variable_name |
| Accented characters are not allowed | déjà_vu | deja_vu |
You don't have to worry about lowercase and uppercase as Delphi is case-insensitive.
Display a variable[edit]
It's easy to display a variable in an application. In a console application, you use the command
.
Here is the result in a whole application:
So this code will display 12.
- Remark: If you don't want the display of a new line, use the Write function rather than WriteLn .
- Remark: You can use the ReadLn function to avoid the console from closing too quickly, but the actual feature of this function is described below.
- Remark: In GUI applications, you display variables in visual components.
Delphi Const
Retrieve a variable[edit]
Delphi Constant
It's easy too. You have to call the ReadLn(variable); function.
You have to first declare the variable you want to use. Here is a whole code:
In the next pages, we will see how to operate variable additions, use variables in loops and conditions, etc..
- Remark: If you don't want to skip a line after the entry, use the Read function rather than ReadLn .
Assignment[edit]
You can set a value to a variable at any time in a program, from another variable for example:
The changed variable is on the left and the variable whose value is duplicated is on the right. Do not confuse.
The constants[edit]
Introduction[edit]
The constants are similar to variables, except one point: they can't change their value during the execution.
The constants of the system[edit]
Those constants specify all the values that are native and defined in the header files.
Vmware esxi 5.5.0 3568722. Esx-base, 5.5.0-3.1, VMware, Updates the ESX 5.5.0 esx-base. Imageprofile ESXi-5.5.0-1-standard (Build 3568722) includes the.
Example:
- stdout points on the screen buffer
- stdin points on the keyboard buffer
The symbolic constants[edit]
The symbolic constants are defined by the developer. They work as the variables, except for their declaration.
To declare a constant, you have to declare it after the reserved keyword const instead of var.
Write an application that asks the user its age and then display it.
In Delphi, the versatile web-programming language, arrays allow a developer to refer to a series of variables by the same name and to use a number—an index—to tell them apart.
In most scenarios, you declare an array as a variable, which allows for array elements to be changed at run-time.
However, sometimes you need to declare a constant array—a read-only array. You cannot change the value of a constant or a read-only variable. Therefore, while declaring a constant array, you must also initialize it.
Example Declaration of Three Constant Arrays
This code example declares and initializes three constant arrays, named Days, CursorMode, and Items.
- Days is a string array of six elements. Days[1] returns the Mon string.
- CursorMode is an array of two elements, whereby declaration CursorMode[false] = crHourGlass and CursorMode = crSQLWait. 'cr*' constants can be used to change the current screen cursor.
- Items defines an array of three TShopItem records.
Trying to assign a value for an item in a constant array raises the 'Left side cannot be assigned to' compile time error. For example, the following code does not successfully execute: