Why this code show error | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why this code show error

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SoloLearn { class Program { static void Main(string[] args) { int age =Convert.ToInt32 (Console .Readline()); if (age > 14 && age<18) Console.WriteLine("Teenager"); else if(age>=18) Console.WriteLine("Adult"); else{ if (age > 0) { Console.WriteLine("Child"); } else { Console.WriteLine("Something's wrong"); } } } } } 'Console' does not have definition for 'Readline'??

13th Oct 2018, 10:13 AM
Prateek Saini
Prateek Saini - avatar
3 Answers
+ 1
Firstly, next time please provide a link to the code. C# is a case sensitive language meaning wOrD and word in C# can be considered different identifiers. Problem is that you typed in Console.readline instead of Console.ReadLine hence the error " 'Console' does not have a definition for 'readline' ".
13th Oct 2018, 10:21 AM
TurtleShell
TurtleShell - avatar
13th Oct 2018, 10:29 AM
TurtleShell
TurtleShell - avatar
0
it doesn't work
13th Oct 2018, 10:25 AM
Prateek Saini
Prateek Saini - avatar