Tuto WINDEV Mobile 25

Part 4: Programming concepts 83 Remark Other types are available, such as arrays, structures, dates, times, ... Advanced variables are also available. These advanced types gather all the characteristics of the element being used in a single variable. Advanced types can be used to handle XML documents, emails, XLS files, ... See the online help for more details. The scope of variables The variables can be declared anywhere in the code. However, according to the position of its declaration, the variable cannot be used to perform processes or calculations. We talk of variable scope. Two types of scope are available: • Global. • Local. Global scope Global means that the variable has an extended visibility in the code. The variable is visible outside the location where it was declared. Several levels are available: • Project and Set of procedures, • Window, Mobile Window, Page, Report. A variable declared at project level has the greatest visibility in the program. The variable is visible anywhere, in all program processes. However, you should not declare too many variables with this scope: indeed, the memory occupied by the variable is always reserved even if the variable is not used. Using a large number of global variables is not recommended in the program architecture. To pass variables to a process, we recommend that you use parameters (see "Parameters of a procedure" for more details). A variable declared at Set of Procedures level and a variable declared at project level have the same visibility. The advantage of declaring a variable at the level of a Set is to group (or classify) the variables by theme (set) in order to make the project initialization process more readable. A variable declared at Window, Mobile Window, Page or Report level limits the scope of the variable to all the processes of the element (Window, Mobile Window, Page or Report) and its controls. This makes it possible to encapsulate and limit the uses. Local scope Local means that the variable has a limited visibility in the code. The variable is visible in the process where it was declared. This makes it possible to restrict the use of variable to the process.

RkJQdWJsaXNoZXIy NDQ0OA==