IT SOLUTIONS
Your full service technology partner! 
-Collapse +Expand
To/From Code
   ► KBTo/From GuidesReferenceOperators  Print This     

Unary Operators (Cross Ref > Operators)

Unary Operators

General Info: Unary Operator

An operation with only one operand (a single input). Common unary operators include + plus, - minus, and bitwise not. Some operators can function as both unary and binary operators. For example, + and - operators can serve as either.

Languages Focus

What unary operators are supported in additoin to the standard plus, minus, and bitwise not.

Access VBA: 

An operation with only one operand (a single input) such as +, -, and Not.

 

More Info

Code:  Access VBA Unary Operators
Definition:  Unary Operator

ASP Classic: 

An operation with only one operand (a single input) such as +, -, and Not.

 

More Info

Code:  ASP Classic Unary Operators
Definition:  Unary Operator

C#: 

An operation with only one operand (a single input). The following are the C# unary operators: +, -, !, ~, ++, --, true, or false. 

 

More Info

Code:  C# Unary Operators
Definition:  Unary Operator

C++: 

An operation with only one operand (a single input) such as ++X and --Y.

More Info / Comment


About Unary Operator
An operation with only one operand (a single input).

More Info

Definition:  C Family Unary Operators
Definition:  Unary Operator

More Info

Definition:  C Family Unary Operators

Corel Paradox: 

The ObjectPAL unary operators are:

+
-
Not

More Info / Comment

More Info

Definition:  Unary Operator

Delphi: 

An operation with only one operand (a single input). In Object Pascal, a unary operator has the highest precedence and always precedes its operand (for example, -B), except for the  ^ pointer operator, which follows its operand (for example, P^). In addition to the obvious +, -, and Not operators, Delphi also offers:

^ Pointer
@ returns the address of a variable, function, procedure, or method; a pointer to its operand.
inc() Increment
dec() Decrement

The TYPE operator is also a unary operator and is valuated at compile time. The TYPE operator returns the size in bytes of the operand,

More Info / Comment

 

More Info

Definition:  Unary Operator

Delphi Prism: 

The obvious Prism unary operators are +, -, and Not.

+ Plus
- Minus
Not Bitwise Not
Inc() Increment
Dec() Decrement

Syntax Example:
var i: Integer := 1;
Inc(i);
MessageBox.Show("" + i);  //Displays 2

Inc() and Dec()

Inc will increment an ordinal or float named variable by 1 or a value you specify. Dec will decrement a named variable by 1 or a value you specify.

Examples:

var i: Integer := 1;
Inc(i);  //Increment by 1 (default).
Inc(i, 3);  //Increment by 3.
Dec(i);     //Decrement by 1 (default).
Dec(i, 3);  //Decrement by 3.
  
//The following displays 3.65.
var i: Double := 1;
Inc(i, 2.65); //Increment by 2.65.

MessageBox.Show("" + i);

More Info

Code:  Delphi Prism Unary Operators
Definition:  Unary Operator

Java: 

An operation with only one operand (a single input). The Java unary operators are ++, --, +, -, ~, and !.

  • + Indicates positive value (numbers are positive without this)
  • - Negates an expression
  • ++ Increment operator by 1
  • -- Decrement operator by 1
  • ! Logical complement operator (inverts the value of a boolean)
  • ~ Bitwise inversion operator (works on integral data types)
More Info / Comment

 

More Info

Definition:  Unary Operator

JavaScript: 

An operation with only one operand (a single input). JavaScript unary operators include ++ and --. They can be used either before or after a variable as in: a++, b--, and ++a, and --b.

Examples:

iCounter++;
iCounter--;
 
++iCounter;
--iCounter;
Syntax Example:
var iCounter=0;
 
for (iCounter=0;iCounter<=5;iCounter++)
{
document.write("Count is " + iCounter + "<br>");
}

Working Example

<html>
<body>
 
<script language=JavaScript>
<!--
var iCounter=0;
 
for (iCounter=0;iCounter<=5;iCounter++)
{
document.write("Count is " + iCounter + "<br>");
}
//-->
</script>
</body>
</html>
 

More Info

Code:  JavaScript Unary Operators
Definition:  Unary Operator

Perl: 

An operation with only one operand (a single input). The following are the Perl unary operators: !, -, ~, +, \, &, and *.

  • ! performs logical negation which is "not"
  • - performs arithmetic negation if the operand is numeric.
  • ~ performs bitwise negation, that is 1's complement.
  • + has no semantic effect whatsoever, even on strings.
  • \ creates a reference to whatsoever follows.
  • & Address of operator.
  • * Dereference address operator.

 

More Info

Code:  Perl Unary Operators
Definition:  Unary Operator

PHP: 

A unary operator operates on only one value.

PHP Examples:

  • ! negation operator
  • ++ increment operator
  • -- decrement operator

 

More Info

Code:  PHP Unary Operators
Definition:  Unary Operator

VB Classic: 

An operation with only one operand (a single input) such as +, -, and Not.

 

More Info

Definition:  Unary Operator
Code:  VB Classic Unary Operators

VB.Net: 

An operation with only one operand (a single input). A unary operator method can return any type but takes only one parameter, which must be the type of the containing class. In addition to the obvious +, -, and Not operators, VB.Net also offers:

isFalse
isTrue

 

More Info

Definition:  Unary Operator
Code:  VB.Net Unary Operators




Go ahead!   Use Us! Call: 916-726-5675  Or visit our new sales site: 
www.prestwood.com


©1995-2024 Prestwood IT Solutions.   [Security & Privacy]