PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

  • Overview
  • Simple variables
  • Notes
  • Limit values for the types of data
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
The different types of data (Type of variable)
Overview
A variable is defined by its name and by its 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:
Simple variables
The "simple" types of WLanguage are as follows (these types can be declared directly, see Declaration of variables):
  • Boolean: recommended type for all the logical operations where only two alternatives are possible:
    • True (value different from 0)
    • False (value equal to 0)
      Example: b is boolean
  • Integer: recommended type for the calculations performed on integer values.
    For advanced calculations, the WLanguage proposes different types of integers.
    Example: b is int
  • Currency: recommended type for the calculations performed on real values that require an absolute precision for the decimals, as currency values for example.
    A currency manages 24 significant digits (up to 18 digits for the integer part and up to 6 digits for the decimal part). The precision is precise to 6 decimals.
    For more details about the currencies.
    Example: MyCurrency is currency
  • Numeric: recommended type for the calculations on real values that required an absolute precision for the decimals.
    A numeric manages 38 significant digits (up to 32 digits for the integer part and up to 6 digits for the decimal part). The precision is precise to 6 decimals.
    For more details about the numerics.
    Example: MyCurrency is numeric
  • Real: recommended type for the simple calculations performed on real values.
    A real manages 15 significant digits but the precision of the decimals is not guaranteed. The precision of decimals is not guaranteed. To perform precise calculations, use the "Currency" type.
    For advanced calculations, the WLanguage proposes different real types.
    Example: VAT is real
  • String: recommended type for managing the characters and the character strings.
    With this type, there is no need to declare the length of the string. This one can freely change when using the variable.
    For an advanced management of character strings (especially for the Windows APIs), the WLanguage proposes different types of strings.
  • Buffer: recommended type for writing code that is portable between WINDEV and WINDEV Mobile. See The buffer type for more details.
  • Date, Time, DateTime, Duration: recommended types for managing the dates and the times.
    The "Date" and "Time" types enable you to easily handle the dates and the times, and to manage the conversions almost automatically.
    More details about Dates and More details about Times.
    The "DateTime" type is used to manage a date and a time at once.
    For more details about DateTime.
    The "Duration" type allows you to easily manage the difference between dates and times.
    For more details about the durations.
  • Variant: recommended type for storing any simple type of WLanguage.
    The Variant type is used to handle the ActiveX or to manage the NULL value.
    For more details about the variants
Notes

Limit values for the types of data

  • If a variable is assigned with 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 find out the limit values of the different types of data, see the "Limits.WL" file found in the "Personal\Extern" sub-directory of WINDEV, WEBDEV or WINDEV Mobile. This file can be opened by any text editor.
  • To simplify your tests, the limit values for the different data types have been assigned to constants in the "Limits.WL" file. To include these constants in your application, use the following code line in the initialization code of your project:
    EXTERN "Limits.WL"

    The "Limits.WL" file will be automatically sought in the "Personal\Extern" sub-directory of WINDEV, WEBDEV or WINDEV Mobile. There is no need to copy the "Limits.WL" file into the project directory. See the help about External for more details.
    Reminder: Each simple type is identified by a WLanguage keyword. These keywords are reserved words.
Minimum required version
  • Version 14
This page is also available for…
Comments
Click [Add] to post a comment