Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

Increment operator c#

//Decrement operator (--)
int i = 3;
Console.WriteLine(i);   // output: 3
Console.WriteLine(i--); // output: 3
Console.WriteLine(i);   // output: 2

double a = 1.5;
Console.WriteLine(a);   // output: 1.5
Console.WriteLine(--a); // output: 0.5
Console.WriteLine(a);   // output: 0.5
//Increment operator (++)
int i = 3;
Console.WriteLine(i);   // output: 3
Console.WriteLine(i++); // output: 3
Console.WriteLine(i);   // output: 4

double a = 1.5;
Console.WriteLine(a);   // output: 1.5
Console.WriteLine(++a); // output: 2.5
Console.WriteLine(a);   // output: 2.5
Comment

c# increment by 1

int i = 0;
i++; // Adds 1 to i
i = i + 1; // Adds 1 to i
Comment

c# increment by 2

for (int i = 0; i < 10; i+=2)
{
    Console.WriteLine(i);
}
Console.ReadLine();
Comment

PREVIOUS NEXT
Code Example
Csharp :: longest substring without repeating characters 
Csharp :: concatenation in c# 
Csharp :: c# callback action lambda 
Csharp :: concat arrays .net 
Csharp :: how to convert timestamp to datetime c# 
Csharp :: bytes size c# 
Csharp :: animation setbool unity 
Csharp :: How to search values in the registry 
Csharp :: c# add strings 
Csharp :: unity dotween sequence 
Csharp :: async await c# 
Csharp :: c# setting window size 
Csharp :: unity check if gameobject is inside collider 
Csharp :: c# clear console read chache 
Csharp :: how to cut a string in c# 
Csharp :: generate UUID id for my entities 
Csharp :: kendo validator tries to validate hidden fields 
Csharp :: unique field in class model .net core 
Csharp :: scene manager load scene 
Csharp :: C# webclient submit form 
Csharp :: top down view player movement 
Csharp :: remove string inside curly braces C# 
Csharp :: c# how to delete all files in directory 
Csharp :: Block iFrames | How to Stop Your Website From Being iFramed 
Csharp :: c# get file author 
Csharp :: remove substring from string c# 
Csharp :: how to set the current user httpcontext.current.user asp.net -mvc 
Csharp :: how prevent user remove file linux 
Csharp :: C# Change color 
Csharp :: unity normalize 
ADD CONTENT
Topic
Content
Source link
Name
5+7 =