Can I type -- switch ( int age = 36)? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can I type -- switch ( int age = 36)?

A brief code

17th Jun 2019, 7:03 PM
Faisal Alghamdi
Faisal Alghamdi - avatar
2 Answers
+ 4
no, you can't do that, the value need to be assigned before use inside switch and not assign inside switche
17th Jun 2019, 7:10 PM
✳AsterisK✳
✳AsterisK✳ - avatar
+ 1
Thanks a lot
18th Jun 2019, 7:36 PM
Faisal Alghamdi
Faisal Alghamdi - avatar