C# How to get original int value after adding or subtracting? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

C# How to get original int value after adding or subtracting?

If I add something to the int var x within the code, for example x++ within a Console.WriteLine() scenario, then the variable changes back to x. How do I change it back to the original variable?

26th Jan 2022, 7:59 PM
Apokvund
Apokvund - avatar
2 Answers
+ 3
You can assign it with its original value again. Isn't it?
27th Jan 2022, 2:29 AM
Simba
Simba - avatar
+ 1
Simba 😅👍 I don't get you completely, you want to change the value and get the previous one? For example like this:? int x = 0; Console.WriteLine(++x): x = 0; Console.Write(x);
29th Jan 2022, 5:05 AM
🇮🇱 Radin Masiha 🇮🇱
🇮🇱 Radin Masiha 🇮🇱 - avatar