Need some help with this C# code please. New to this. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Need some help with this C# code please. New to this.

https://code.sololearn.com/cdmF5Zs5zLx8/?ref=app

24th May 2018, 9:18 PM
Quazar1sumtin
Quazar1sumtin - avatar
8 Answers
+ 1
Everything works fine except when user is too young. Seems to repeat it's self infinitely. Please Halllp 😅
24th May 2018, 9:19 PM
Quazar1sumtin
Quazar1sumtin - avatar
+ 1
You read in an age, if it is less than 18, you do repeat infinitely. You need to either reread the age within the while, if you think they might suddenly have a birthday, or remove the while loop as it doesn't change the age so is infinite.
24th May 2018, 9:26 PM
John Wells
John Wells - avatar
+ 1
If they are 17, it isn't likely their birthday is in a minute. I'd delete the while and make it so the rest of the code is in the else of the <= 17.
24th May 2018, 9:36 PM
John Wells
John Wells - avatar
24th May 2018, 9:39 PM
John Wells
John Wells - avatar
0
Thanks guys, just have a hard time wrapping my head around it. I've gotten it to work without the Array on on another code on my profile. So I need to remove the while () and add something to check if they had a birthday?
24th May 2018, 9:34 PM
Quazar1sumtin
Quazar1sumtin - avatar
0
also I've tried adding breaks but it just ends the entire program 😓
24th May 2018, 9:34 PM
Quazar1sumtin
Quazar1sumtin - avatar
0
Thanks Happy. how would that look if you don't mind me asking
24th May 2018, 9:36 PM
Quazar1sumtin
Quazar1sumtin - avatar
0
Thanks mate
24th May 2018, 10:21 PM
Quazar1sumtin
Quazar1sumtin - avatar