UNARY/MINUS 1g 2023-04-17 laplante@plcb.ca GOWEB/Language


title: “GoWeb UNARY MINUS Operator” author: “Pierre Laplante” date: 2025-08-30 version: “1.0.0” section: “1g”

module: “Goweb/Language”

Name

UNARY MINUS Operator

This document explains the usage of the unary minus (-) operator in GoWeb.
The unary minus is used to represent negative numbers and to invert the sign of numeric values.

Description

Examples

Example 1: Negative literal

res={ -5; }.

Result:

res=-5.

Example 2: Assigning a negative value

res={ a := -5; a; }.

Result:

res=-5.

Example 3: Inverting the sign of a variable

res={ a := -5; -a; }.

Result:

res=5.

Example 4: Subtracting a negative number

res={ a := 5 - -5; a; }.

Result:

res=10.

Example 5: Multiplying a negative number

res={ a := -5; a * -2; }.

Result:

res=10.

Version