GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Processing
  • Download
  • Reference
  • Environment
  • Libraries
  • Tools
  • Wiki
  • Tutorials
  • Examples
  • Books
  • Forum
  • Overview
  • People
  • Privacy

This view

  • Original page
  • New address

GeezerVison is showing processing.org — - (minus) / Reference

Reference+
Documentation→Reference→Math→Operators

Name

- (minus)

Description

Subtracts one value from another and may also be used to negate a value. As a subtraction operator, the value of the second parameter is subtracted from the first. For example, 5 - 3 yields the number 2. As a negation operator, it is equivalent to multiplying a number by -1. For example, -5 is the same as 5 * ‑1.

Examples

  • int c = 50 - 5;  // Sets 'c' to 45
    int d = c - 5;   // Sets 'd' to 40
    int e = d - 60;  // Sets 'e' to -20
    
  • int a = 5;         // Sets 'a' to 5 
    int b = -a;        // Sets 'b' to -5 
    int c = -(5 + 3);  // Sets 'c' to -8 
    

Syntax

  • -value1
  • value1 - value2

Parameters

  • value1int or float
  • value2int or float

Related

  • decrement
  • subtractassign
  • addition
Creative Commons License

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.