+ 1

Change variable

In python i can change the variable like this a = 2 b = 10 a , b = b , a And variables changed Now I have problem in Csharp I wonna write this on csharp

14th Mar 2022, 6:57 PM
Unknown
Unknown - avatar
3 Respuestas
+ 9
Unknown , in c# this can be done very similar like in python. see the code in the attached file: (works for string and integer, double,...) https://code.sololearn.com/cUbX8SkJv3X5/?ref=app
14th Mar 2022, 8:05 PM
Lothar
Lothar - avatar
+ 2
Use a 3rd variable as helper. In case the variables are numeric, you can do something like: a = a + b; b = a - b; a = a - b;
14th Mar 2022, 7:28 PM
Lisa
Lisa - avatar