Could you say why it doesn't work? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Could you say why it doesn't work?

Console.WriteLine("vamos a evaluar si puedes conducir un coche. ¿Qué edad tienes?"); int edad = Int32.Parse(Console.ReadLine()); bool carnet; if(edad>=18) carnet = true; if (carnet==true) Console.WriteLine("Tienes edad suficiente para conducir"); else Console.WriteLine("Lo siento, no tienes edad para conducir");

30th Jul 2020, 9:17 AM
Daniel Montero Román
Daniel Montero Román - avatar
2 Answers
+ 2
Initialize <carnet> bool carnet = false; Or you can opt to initialize with condition bool carnet = (edad >= 18);
30th Jul 2020, 9:26 AM
Ipang
+ 2
I Understand now. It allways make sense! XD Thanks both!
30th Jul 2020, 9:54 AM
Daniel Montero Román
Daniel Montero Román - avatar