What is the error? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0
14th Mar 2023, 5:48 AM
Welcome To Dodgeball
Welcome To Dodgeball - avatar
8 Answers
+ 4
First off, as the compiler tells you, there is a closing curly missing for the if(age>=18) branch. Then there may be some errors of a logical nature in the age limits. E.g. a newborn is 0 years of age, yet you disallow 0. A child of thirTEEN is a teenager, but your program requires an age of 15 to be accepted as teenager. But I cannot say there are errors since I do not know the original task. Perhaps these are the correct limits, I don't know.
14th Mar 2023, 6:01 AM
Ani Jona 🕊
Ani Jona 🕊 - avatar
+ 2
But it belongs in line 15 ½. The one in line 19 belongs to age>=13.
14th Mar 2023, 6:24 AM
Ani Jona 🕊
Ani Jona 🕊 - avatar
+ 2
Incidentally, when the compiler tells you there is a curly missing before the else in line 16, then it is usually a moot point trying to argue with the compiler ;) I am just a messenger passing on to you what the compiler says. But you can read it yourself after you hit "run"...
14th Mar 2023, 6:27 AM
Ani Jona 🕊
Ani Jona 🕊 - avatar
+ 1
It works now
14th Mar 2023, 6:46 PM
Welcome To Dodgeball
Welcome To Dodgeball - avatar
+ 1
It's finished
14th Mar 2023, 7:04 PM
Welcome To Dodgeball
Welcome To Dodgeball - avatar
+ 1
Awesome :D
14th Mar 2023, 7:10 PM
Ani Jona 🕊
Ani Jona 🕊 - avatar
0
There is no missing } because it's on line 19
14th Mar 2023, 6:20 AM
Welcome To Dodgeball
Welcome To Dodgeball - avatar
0
Only one curly brace "}" of first nested "if" is missing If(...){ If(....){ ........ }<- this curly brace is missing in your code
14th Mar 2023, 10:08 AM
Karuna Pawar
Karuna Pawar - avatar