Is there a way to initialize multiple variables in c#? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Is there a way to initialize multiple variables in c#?

Like this: int a, b, c, d = 1;?

14th Dec 2017, 12:18 PM
🇨🇿 Petr Vitásek
🇨🇿 Petr Vitásek - avatar
1 Answer
+ 4
You can do : int a = 1, b = 1, c = 1; or int a, b, c; a = b = c = 1;
14th Dec 2017, 11:33 PM
Bryan Martinet
Bryan Martinet - avatar