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

PREVIOUS NEXT
Code Example
Csharp :: unity string lowercase 
Csharp :: c# contains() 
Csharp :: how to add a gameobject 
Csharp :: c# get country code 
Csharp :: shorthand if c# 
Csharp :: getmousebuttondown unity 
Csharp :: unity button press 
Csharp :: dotnet new api 
Csharp :: unity call function from another script 
Csharp :: array sort c# 
Csharp :: C# add two numbers using a method 
Csharp :: how to set a transform equal to something unity 
Csharp :: get current time c# 
Csharp :: c# see if list contains any duplicates 
Csharp :: c# multi assignment 
Csharp :: Customize yup number 
Csharp :: unity get default font 
Csharp :: or c# 
Csharp :: difference between boxing and unboxing in c# 
Csharp :: add a dictionary to another dictionary c# 
Csharp :: get percentage c# 
Csharp :: c# run batch file 
Csharp :: IHttpContextAccessor 
Csharp :: how to remove all whitespace from a string in c# 
Csharp :: unity get gameobject from hit 
Csharp :: c# string to int 
Csharp :: how to get a length of a string in c# 
Csharp :: csharp get decimal part of number 
Csharp :: c# wpf timer 
Csharp :: unity vector3 to array 
ADD CONTENT
Topic
Content
Source link
Name
4+7 =