AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Sintaxis WLanguage / Operadores
  • Use
  • Rules
  • Calculation rules
  • Notes
  • Result display
  • Equivalence
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Otros
Procedimientos almacenados
Arithmetic operators
Use
The arithmetic operators are:
  • "+": Addition (numeric value or string).
  • "-": Subtraction (numeric value).
  • "*": Multiplication.
  • "/": Division.
  • "++": Increment (numeric value).
  • "--": Decrement (numeric value).
  • "+=": Adding a value to the variable or to the control (numeric or text).
  • "-=": Subtracting a value from the variable or from the control (numeric).
  • Modulo: Returns the remainder of a division.
  • Novedad versión 2024
    "%": Returns the remainder of an integer division (Modulo equivalent).
  • "^": Power (equivalent to Power).
Rules

Calculation rules

The different calculations are performed without loss of precision and without being truncated. The flow checks are performed when the result is assigned to a variable.
Notes

Result display

The result of the calculation can be directly displayed using the following operators:
  • "++": Incremental
  • "--": Decrement
When the ++ (--) operator is used as an expression (e.g.: Info(x++)), its behavior is determined by the position of the operator, relative to the incremented variable:
  • ++x (--x) => increments (decrements) x then returns x.
  • x++ (x--) => returns the value of x then increments (decrements) x.
For example:
let x is int = 5
Trace(x++) 	// Affiche 5. x vaut 6 
Trace(++x) 	// Affiche 7. x vaut 7
Trace(--x) 	// Affiche 6. x vaut 6
Trace(x--) 	// Affiche 6. x vaut 5
Trace(x)	// Affiche 5
The result of the calculation cannot be directly displayed by the following operators:
  • "+=": Adding a value to the variable or to the control (numeric or text)
  • "-=": Subtracting a value from the variable or from the control (numeric)
Therefore, this example generates an error during the compilation:
num is int = 10
Trace(num+=1)
To display the result, perform the following modifications:
num is int = 10
num += 1
Trace(num)

Equivalence

  • j ++ is equivalent to j = j + 1
  • j -- is equivalent to j = j - 1
  • j += 3 is equivalent to j = j + 3
  • j -= 3 is equivalent to j = j - 3
We recommend that you use the following syntaxes: "j ++", "j --", "j +=" and "j -=", that are faster than the usual syntaxes.
Ver también
Versión mínima requerida
  • Versión 9
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 30/04/2024

Señalar un error o enviar una sugerencia | Ayuda local