ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

New WEBDEV 2024 feature!
Help / WEBDEV Tutorial / Tutorial - WLanguage basics
  • Lesson 2 - Variables
  • Practical example
  • What is a variable?
  • Declaring a variable
  • Assignment and use
  • Types of variables
  • Simple operations on variables
  • Tips
  • Variable type details: String variables
  • The String type
  • Building a string
  • Operations on strings
  • Finding a string
  • Comparing two strings
  • To sum up

Tutorial - WLanguage basics

Lesson 2 - Variables
We will cover the following topics:
  • What is a variable?
  • The different types of variables.
  • The String type in detail.
Durée de la leçon 20 mn
Practical example
To follow the steps in this lesson, we will use the "WLanguage" project that we created in the previous lesson (see A project to discover WLanguage in lesson 1).
We will write the code directly in the project initialization code. This is the first section of code executed when the project is tested: we can do tests very simply, without any interface.
To view the results of our operations, we will use Trace, which lets us write the desired information both to a trace window and to the debugger pane at the bottom of the editor. In this tutorial, we will use the debugger pane.
Trace window
Trace window
"Debugger trace" pane

This pane is not displayed by default. The "Debugger trace" pane will be displayed automatically when you test the example.


First step for our tests: open the WLanguage events of the project. To do so:
  1. Right-click the "P" button next to the open element tabs. The context menu appears.
    Context menu of the project
  2. Select "Element code".
  3. The code editor displays the different WLanguage events associated with the project.
What is a variable?
In a programming language, a variable is used to store data. These memory sections contain strings, numbers, etc.
Variables are used to perform calculations, comparisons, or to store information that will be used later.
Declaring and initializing a variable
A variable is represented by:
  • a name: Name given to the variable so that it can be manipulated in the code.
  • a type: Type of the data stored in the variable. In this tutorial, we will look at a few types of variable in detail.
  • a value: Information stored in the variable.
  • a scope: Scope of the variable in the program. The scope is mainly defined by the location where the variable is declared. For more details on this topic, see Scope of variables.

Declaring a variable

Assignment and use

Types of variables
Simple operations on variables

Tips

Variable type details: String variables

The String type

Building a string

Operations on strings

Finding a string

Comparing two strings

To sum up
Previous LessonTable of contentsNext Lesson
Minimum version required
  • Version 2024
Comments
Click [Add] to post a comment

Last update: 04/08/2024

Send a report | Local help