|
|
|
|
- Overview
- Simple variables
- Notes
- Limit values of data types
Different types of data (Type of variable)
A variable is defined by name and type. The variable type defines the values that can be taken by the variable, its memory footprint and the available operations. The different types of variables are: The "simple" types of WLanguage are as follows (these types can be declared directly, see Declaration of variables): - Boolean: recommended type for logical operations with two possible values:
- True (value different from 0)
- False (value equal to 0)
Example:
- Integer: recommended type for calculations with integer values.
For advanced calculations, WLanguage offers different types of integers. Example:
- Currency: recommended type for calculations with real values that require absolute precision for decimals, e.g., currency values.
A currency supports 24 significant digits (up to 17 digits for the integer part and 6 digits for the decimal part). The number can contain up to 6 decimals. More details about the Currency type. Example:
- Numeric: recommended type for calculations with real values that require absolute precision for decimals.
A numeric supports 38 significant digits (up to 32 digits for the integer part and 6 digits for the decimal part). The number can contain up to 6 decimals. More details about the Numeric type. Example:
- Real: recommended type for simple calculations with real values.
A real supports 15 significant digits but it does not necessarily contain precise decimals. The precision of decimals is not guaranteed. For accurate calculations, use "Currency". For advanced calculations, WLanguage offers different real types. Example:
- String: recommended type for characters and character strings.
With this type, there is no need to declare the length of the string. It can change when the variable is used. For an advanced management of character strings (especially for Windows APIs), WLanguage offers different types of strings. - Buffer: recommended type for portable code between WINDEV and WINDEV Mobile. For more details, see The buffer type.
- Date, Time, DateTime, Duration: recommended types for dates and times.
The "Date" and "Time" types enable you to easily handle dates and times, and to manage conversions almost automatically. More details about the Date type and More details about the Time type. The "DateTime" type is used to simultaneously manage dates and times. More details about the DateTime type. The "Duration" type allows you to easily manage the difference between dates and times. More details about the Duration type. - Variant: recommended type for any simple type of WLanguage.
The Variant type is used to handle ActiveX or manage the NULL value. More details about the Variant type
Limit values of data types - If a variable is assigned a value that exceeds the limits of its type:
- an error message is generated when running the test of a window, page or project.
- no error message signals the capacity overflow when the program is run. The value of the variable is incorrect.
- To know the limit values of the different data types, see the "Limits.WL" file in the "Personal\Extern" subdirectory of WINDEV, WEBDEV or WINDEV Mobile. This file can be opened by any text editor.
- To simplify your tests, the limit values of the different data types have been associated with constants in the "Limits.WL" file. To include these constants in your application, use the following line of code in the initialization code of your project:
The "Limits.WL" file will be automatically searched in the "Personal\Extern" subdirectory of WINDEV, WEBDEV or WINDEV Mobile. There is no need to copy the "Limits.WL" file to the project directory. For more details, see the help of the Extern keyword. Reminder: Each simple type is identified by a WLanguage keyword. These keywords are reserved words.
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|