This blog defines the Increment and decrement
operator in VB.NET.
VB.NET does not support
like this ++ and --
VB.NET replaces the i++
to i=+1
VB.NET replaces the i++
to i=-1
For example
Module
Module1
Sub Main()
Dim i As
Integer
i = 5
Dim j As
Integer
i = i + 1
Console.WriteLine(i)
i = i - 1
Console.WriteLine(i)
End Sub
End
Module
OUTPUT
The output will be 6,5.
C# supports like this ++ and --
The ++ and the –- are the increment and
decrement operators.
Increment(++) operator
The increment operator increases its operand by
one.
For example
y=y+1
can be rewritten like this by
use for the increment operator.
y++
Decrement(--) operator
The decrement operator decreases its operand by
one.
For example
y=y-1
can be rewritten like this by
use for the increment operator.
y--
For example
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
namespace
ConsoleApplication12
{
class Program
{
static void
Main(string[] args)
{
int i = 5;
i++;
Console.WriteLine(i);
i--;
Console.WriteLine(i);
}
}
}
OUTPUT
The output will be 6,5.