Gambas/Nudge

From Wikibooks, open books for an open world
< Gambas
Jump to: navigation, search

Contents

[edit] Nudging Variables

The nudge operators ++ and -- are not supported in gambas. However, gambas does provide the INC and DEC commands and combination assignment operators that can be used to increment or decrement variables:

[edit] Nudging variables with INC or DEC

The INC and DEC commands can be used to increment or decrement numeric variables:

[edit] INC

INC variable     ' variable = variable + 1

[edit] DEC

DEC variable     ' variable = variable - 1

[edit] Nudging variables with the combination assignment operators

The combination assignment operators can be used to increment or decrement numeric variables:

variable += 1    ' variable = variable + 1
variable -= 1    ' variable = variable - 1

[edit] INC or DEC commands cannot be used on constants or non-numeric variables

The INC or DEC commands cannot be used on constants or non-numeric variables.

Attempting to nudge string values with INC or DEC commands will result in a type mismatch error.

Attempting to nudge string values with INC or DEC commands will result in a invalid assignment error.

Personal tools
Namespaces
Variants
Actions
Navigation
Community
Toolbox
Sister projects
Print/export